@cabloy/vue-runtime-core 3.4.31 → 3.4.33

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,11 +1,11 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.27
2
+ * @cabloy/vue-runtime-core v3.4.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { pauseTracking, resetTracking, isRef, toRaw, shallowReadonly, isShallow, isReactive, ReactiveEffect, getCurrentScope, ref, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, customRef, isReadonly } from '@vue/reactivity';
6
+ import { pauseTracking, resetTracking, isRef, toRaw, shallowReadonly, ref, track, reactive, shallowReactive, trigger, ReactiveEffect, isShallow, isReactive, getCurrentScope, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, customRef, isReadonly } from '@vue/reactivity';
7
7
  export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
8
- import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, isReservedProp, EMPTY_ARR, toRawType, makeMap, def, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue } from '@vue/shared';
8
+ import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, isBuiltInDirective, isGloballyAllowed, NO, isReservedProp, EMPTY_ARR, toRawType, makeMap, def, remove, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, invokeArrayFns, hasChanged, isSet, isMap, isPlainObject, isRegExp } from '@vue/shared';
9
9
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
10
10
 
11
11
  const stack = [];
@@ -26,6 +26,7 @@ function warn$1(msg, ...args) {
26
26
  instance,
27
27
  11,
28
28
  [
29
+ // eslint-disable-next-line no-restricted-syntax
29
30
  msg + args.map((a) => {
30
31
  var _a, _b;
31
32
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
@@ -116,8 +117,7 @@ function formatProp(key, value, raw) {
116
117
  }
117
118
  }
118
119
  function assertNumber(val, type) {
119
- if (!!!(process.env.NODE_ENV !== "production"))
120
- return;
120
+ if (!!!(process.env.NODE_ENV !== "production")) return;
121
121
  if (val === void 0) {
122
122
  return;
123
123
  } else if (typeof val !== "number") {
@@ -372,10 +372,11 @@ function flushPostFlushCbs(seen) {
372
372
  seen = seen || /* @__PURE__ */ new Map();
373
373
  }
374
374
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
375
- if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
375
+ const cb = activePostFlushCbs[postFlushIndex];
376
+ if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
376
377
  continue;
377
378
  }
378
- activePostFlushCbs[postFlushIndex]();
379
+ if (cb.active !== false) cb();
379
380
  }
380
381
  activePostFlushCbs = null;
381
382
  postFlushIndex = 0;
@@ -385,10 +386,8 @@ const getId = (job) => job.id == null ? Infinity : job.id;
385
386
  const comparator = (a, b) => {
386
387
  const diff = getId(a) - getId(b);
387
388
  if (diff === 0) {
388
- if (a.pre && !b.pre)
389
- return -1;
390
- if (b.pre && !a.pre)
391
- return 1;
389
+ if (a.pre && !b.pre) return -1;
390
+ if (b.pre && !a.pre) return 1;
392
391
  }
393
392
  return diff;
394
393
  };
@@ -496,8 +495,7 @@ function rerender(id, newRender) {
496
495
  }
497
496
  function reload(id, newComp) {
498
497
  const record = map.get(id);
499
- if (!record)
500
- return;
498
+ if (!record) return;
501
499
  newComp = normalizeClassComponent(newComp);
502
500
  updateComponentDef(record.initialDef, newComp);
503
501
  const instances = [...record.instances];
@@ -518,7 +516,10 @@ function reload(id, newComp) {
518
516
  hmrDirtyComponents.delete(oldComp);
519
517
  } else if (instance.parent) {
520
518
  instance.parent.effect.dirty = true;
521
- queueJob(instance.parent.update);
519
+ queueJob(() => {
520
+ instance.parent.update();
521
+ hmrDirtyComponents.delete(oldComp);
522
+ });
522
523
  } else if (instance.appContext.reload) {
523
524
  instance.appContext.reload();
524
525
  } else if (typeof window !== "undefined") {
@@ -581,6 +582,7 @@ function setDevtoolsHook$1(hook, target) {
581
582
  // (#4815)
582
583
  typeof window !== "undefined" && // some envs mock window but not fully
583
584
  window.HTMLElement && // also exclude jsdom
585
+ // eslint-disable-next-line no-restricted-syntax
584
586
  !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
585
587
  ) {
586
588
  const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
@@ -658,8 +660,7 @@ function devtoolsComponentEmit(component, event, params) {
658
660
  }
659
661
 
660
662
  function emit(instance, event, ...rawArgs) {
661
- if (instance.isUnmounted)
662
- return;
663
+ if (instance.isUnmounted) return;
663
664
  const props = instance.vnode.props || EMPTY_OBJ;
664
665
  if (!!(process.env.NODE_ENV !== "production")) {
665
666
  const {
@@ -814,8 +815,7 @@ function popScopeId() {
814
815
  }
815
816
  const withScopeId = (_id) => withCtx;
816
817
  function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
817
- if (!ctx)
818
- return fn;
818
+ if (!ctx) return fn;
819
819
  if (fn._n) {
820
820
  return fn;
821
821
  }
@@ -1231,7 +1231,6 @@ const SuspenseImpl = {
1231
1231
  }
1232
1232
  },
1233
1233
  hydrate: hydrateSuspense,
1234
- create: createSuspenseBoundary,
1235
1234
  normalize: normalizeSuspenseChildren
1236
1235
  };
1237
1236
  const Suspense = SuspenseImpl ;
@@ -1618,7 +1617,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1618
1617
  next() {
1619
1618
  return suspense.activeBranch && next(suspense.activeBranch);
1620
1619
  },
1621
- registerDep(instance, setupRenderEffect) {
1620
+ registerDep(instance, setupRenderEffect, optimized2) {
1622
1621
  const isInPendingSuspense = !!suspense.pendingBranch;
1623
1622
  if (isInPendingSuspense) {
1624
1623
  suspense.deps++;
@@ -1652,7 +1651,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1652
1651
  hydratedEl ? null : next(instance.subTree),
1653
1652
  suspense,
1654
1653
  namespace,
1655
- optimized
1654
+ optimized2
1656
1655
  );
1657
1656
  if (placeholder) {
1658
1657
  remove(placeholder);
@@ -1782,795 +1781,291 @@ function isVNodeSuspensible(vnode) {
1782
1781
  return suspensible != null && suspensible !== false;
1783
1782
  }
1784
1783
 
1785
- const ssrContextKey = Symbol.for("v-scx");
1786
- const useSSRContext = () => {
1787
- {
1788
- const ctx = inject(ssrContextKey);
1789
- if (!ctx) {
1790
- !!(process.env.NODE_ENV !== "production") && warn$1(
1791
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
1792
- );
1784
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
1785
+ if (target) {
1786
+ const hooks = target[type] || (target[type] = []);
1787
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1788
+ pauseTracking();
1789
+ const reset = setCurrentInstance(target);
1790
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
1791
+ reset();
1792
+ resetTracking();
1793
+ return res;
1794
+ });
1795
+ if (prepend) {
1796
+ hooks.unshift(wrappedHook);
1797
+ } else {
1798
+ hooks.push(wrappedHook);
1793
1799
  }
1794
- return ctx;
1795
- }
1796
- };
1797
-
1798
- function watchEffect(effect, options) {
1799
- return doWatch(effect, null, options);
1800
- }
1801
- function watchPostEffect(effect, options) {
1802
- return doWatch(
1803
- effect,
1804
- null,
1805
- !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "post" }) : { flush: "post" }
1806
- );
1807
- }
1808
- function watchSyncEffect(effect, options) {
1809
- return doWatch(
1810
- effect,
1811
- null,
1812
- !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
1813
- );
1814
- }
1815
- const INITIAL_WATCHER_VALUE = {};
1816
- function watch(source, cb, options) {
1817
- if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
1800
+ return wrappedHook;
1801
+ } else if (!!(process.env.NODE_ENV !== "production")) {
1802
+ const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
1818
1803
  warn$1(
1819
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
1804
+ `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
1820
1805
  );
1821
1806
  }
1822
- return doWatch(source, cb, options);
1823
1807
  }
1824
- function doWatch(source, cb, {
1825
- immediate,
1826
- deep,
1827
- flush,
1828
- once,
1829
- onTrack,
1830
- onTrigger
1831
- } = EMPTY_OBJ) {
1832
- if (cb && once) {
1833
- const _cb = cb;
1834
- cb = (...args) => {
1835
- _cb(...args);
1836
- unwatch();
1837
- };
1808
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
1809
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
1810
+ injectHook(lifecycle, (...args) => hook(...args), target);
1838
1811
  }
1839
- if (!!(process.env.NODE_ENV !== "production") && deep !== void 0 && typeof deep === "number") {
1840
- warn$1(
1841
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
1842
- );
1812
+ if (lifecycle === "m" && target && target.isMounted) {
1813
+ hook();
1843
1814
  }
1844
- if (!!(process.env.NODE_ENV !== "production") && !cb) {
1845
- if (immediate !== void 0) {
1846
- warn$1(
1847
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
1848
- );
1815
+ };
1816
+ const onBeforeMount = createHook("bm");
1817
+ const onMounted = createHook("m");
1818
+ const onBeforeUpdate = createHook("bu");
1819
+ const onUpdated = createHook("u");
1820
+ const onBeforeUnmount = createHook("bum");
1821
+ const onUnmounted = createHook("um");
1822
+ const onServerPrefetch = createHook("sp");
1823
+ const onRenderTriggered = createHook(
1824
+ "rtg"
1825
+ );
1826
+ const onRenderTracked = createHook(
1827
+ "rtc"
1828
+ );
1829
+ function onErrorCaptured(hook, target = currentInstance) {
1830
+ injectHook("ec", hook, target);
1831
+ }
1832
+
1833
+ function validateDirectiveName(name) {
1834
+ if (isBuiltInDirective(name)) {
1835
+ warn$1("Do not use built-in directive ids as custom directive id: " + name);
1836
+ }
1837
+ }
1838
+ function withDirectives(vnode, directives) {
1839
+ if (currentRenderingInstance === null) {
1840
+ !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
1841
+ return vnode;
1842
+ }
1843
+ const instance = getComponentPublicInstance(currentRenderingInstance);
1844
+ const bindings = vnode.dirs || (vnode.dirs = []);
1845
+ for (let i = 0; i < directives.length; i++) {
1846
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
1847
+ if (dir) {
1848
+ if (isFunction(dir)) {
1849
+ dir = {
1850
+ mounted: dir,
1851
+ updated: dir
1852
+ };
1853
+ }
1854
+ if (dir.deep) {
1855
+ traverse(value);
1856
+ }
1857
+ bindings.push({
1858
+ dir,
1859
+ instance,
1860
+ value,
1861
+ oldValue: void 0,
1862
+ arg,
1863
+ modifiers
1864
+ });
1849
1865
  }
1850
- if (deep !== void 0) {
1851
- warn$1(
1852
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
1853
- );
1866
+ }
1867
+ return vnode;
1868
+ }
1869
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
1870
+ const bindings = vnode.dirs;
1871
+ const oldBindings = prevVNode && prevVNode.dirs;
1872
+ for (let i = 0; i < bindings.length; i++) {
1873
+ const binding = bindings[i];
1874
+ if (oldBindings) {
1875
+ binding.oldValue = oldBindings[i].value;
1854
1876
  }
1855
- if (once !== void 0) {
1856
- warn$1(
1857
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
1858
- );
1877
+ let hook = binding.dir[name];
1878
+ if (hook) {
1879
+ pauseTracking();
1880
+ callWithAsyncErrorHandling(hook, instance, 8, [
1881
+ vnode.el,
1882
+ binding,
1883
+ vnode,
1884
+ prevVNode
1885
+ ]);
1886
+ resetTracking();
1859
1887
  }
1860
1888
  }
1861
- const warnInvalidSource = (s) => {
1862
- warn$1(
1863
- `Invalid watch source: `,
1864
- s,
1865
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1866
- );
1867
- };
1868
- const instance = currentInstance;
1869
- const reactiveGetter = (source2) => deep === true ? source2 : (
1870
- // for deep: false, only traverse root-level properties
1871
- traverse(source2, deep === false ? 1 : void 0)
1872
- );
1873
- let getter;
1874
- let forceTrigger = false;
1875
- let isMultiSource = false;
1876
- if (isRef(source)) {
1877
- getter = () => source.value;
1878
- forceTrigger = isShallow(source);
1879
- } else if (isReactive(source)) {
1880
- getter = () => reactiveGetter(source);
1881
- forceTrigger = true;
1882
- } else if (isArray(source)) {
1883
- isMultiSource = true;
1884
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1885
- getter = () => source.map((s) => {
1886
- if (isRef(s)) {
1887
- return s.value;
1888
- } else if (isReactive(s)) {
1889
- return reactiveGetter(s);
1890
- } else if (isFunction(s)) {
1891
- return callWithErrorHandling(s, instance, 2);
1892
- } else {
1893
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
1894
- }
1895
- });
1896
- } else if (isFunction(source)) {
1897
- if (cb) {
1898
- getter = () => callWithErrorHandling(source, instance, 2);
1889
+ }
1890
+
1891
+ function renderList(source, renderItem, cache, index) {
1892
+ let ret;
1893
+ const cached = cache && cache[index];
1894
+ if (isArray(source) || isString(source)) {
1895
+ ret = new Array(source.length);
1896
+ for (let i = 0, l = source.length; i < l; i++) {
1897
+ ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
1898
+ }
1899
+ } else if (typeof source === "number") {
1900
+ if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
1901
+ warn$1(`The v-for range expect an integer value but got ${source}.`);
1902
+ }
1903
+ ret = new Array(source);
1904
+ for (let i = 0; i < source; i++) {
1905
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1906
+ }
1907
+ } else if (isObject(source)) {
1908
+ if (source[Symbol.iterator]) {
1909
+ ret = Array.from(
1910
+ source,
1911
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
1912
+ );
1899
1913
  } else {
1900
- getter = () => {
1901
- if (cleanup) {
1902
- cleanup();
1903
- }
1904
- return callWithAsyncErrorHandling(
1905
- source,
1906
- instance,
1907
- 3,
1908
- [onCleanup]
1909
- );
1910
- };
1914
+ const keys = Object.keys(source);
1915
+ ret = new Array(keys.length);
1916
+ for (let i = 0, l = keys.length; i < l; i++) {
1917
+ const key = keys[i];
1918
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1919
+ }
1911
1920
  }
1912
1921
  } else {
1913
- getter = NOOP;
1914
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
1922
+ ret = [];
1915
1923
  }
1916
- if (cb && deep) {
1917
- const baseGetter = getter;
1918
- getter = () => traverse(baseGetter());
1924
+ if (cache) {
1925
+ cache[index] = ret;
1919
1926
  }
1920
- let cleanup;
1921
- let onCleanup = (fn) => {
1922
- cleanup = effect.onStop = () => {
1923
- callWithErrorHandling(fn, instance, 4);
1924
- cleanup = effect.onStop = void 0;
1925
- };
1926
- };
1927
- let ssrCleanup;
1928
- if (isInSSRComponentSetup) {
1929
- onCleanup = NOOP;
1930
- if (!cb) {
1931
- getter();
1932
- } else if (immediate) {
1933
- callWithAsyncErrorHandling(cb, instance, 3, [
1934
- getter(),
1935
- isMultiSource ? [] : void 0,
1936
- onCleanup
1937
- ]);
1938
- }
1939
- if (flush === "sync") {
1940
- const ctx = useSSRContext();
1941
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1942
- } else {
1943
- return NOOP;
1944
- }
1945
- }
1946
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1947
- const job = () => {
1948
- if (!effect.active || !effect.dirty) {
1949
- return;
1950
- }
1951
- if (cb) {
1952
- const newValue = effect.run();
1953
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
1954
- if (cleanup) {
1955
- cleanup();
1956
- }
1957
- callWithAsyncErrorHandling(cb, instance, 3, [
1958
- newValue,
1959
- // pass undefined as the old value when it's changed for the first time
1960
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1961
- onCleanup
1962
- ]);
1963
- oldValue = newValue;
1964
- }
1965
- } else {
1966
- effect.run();
1967
- }
1968
- };
1969
- job.allowRecurse = !!cb;
1970
- let scheduler;
1971
- if (flush === "sync") {
1972
- scheduler = job;
1973
- } else if (flush === "post") {
1974
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1975
- } else {
1976
- job.pre = true;
1977
- if (instance)
1978
- job.id = instance.uid;
1979
- scheduler = () => queueJob(job);
1980
- }
1981
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
1982
- const scope = getCurrentScope();
1983
- const unwatch = () => {
1984
- effect.stop();
1985
- if (scope) {
1986
- remove(scope.effects, effect);
1987
- }
1988
- };
1989
- if (!!(process.env.NODE_ENV !== "production")) {
1990
- effect.onTrack = onTrack;
1991
- effect.onTrigger = onTrigger;
1992
- }
1993
- if (cb) {
1994
- if (immediate) {
1995
- job();
1996
- } else {
1997
- oldValue = effect.run();
1998
- }
1999
- } else if (flush === "post") {
2000
- queuePostRenderEffect(
2001
- effect.run.bind(effect),
2002
- instance && instance.suspense
2003
- );
2004
- } else {
2005
- effect.run();
2006
- }
2007
- if (ssrCleanup)
2008
- ssrCleanup.push(unwatch);
2009
- return unwatch;
2010
- }
2011
- function instanceWatch(source, value, options) {
2012
- const publicThis = this.proxy;
2013
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
2014
- let cb;
2015
- if (isFunction(value)) {
2016
- cb = value;
2017
- } else {
2018
- cb = value.handler;
2019
- options = value;
2020
- }
2021
- const reset = setCurrentInstance(this);
2022
- const res = doWatch(getter, cb.bind(publicThis), options);
2023
- reset();
2024
- return res;
2025
- }
2026
- function createPathGetter(ctx, path) {
2027
- const segments = path.split(".");
2028
- return () => {
2029
- let cur = ctx;
2030
- for (let i = 0; i < segments.length && cur; i++) {
2031
- cur = cur[segments[i]];
2032
- }
2033
- return cur;
2034
- };
2035
- }
2036
- function traverse(value, depth = Infinity, seen) {
2037
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2038
- return value;
2039
- }
2040
- seen = seen || /* @__PURE__ */ new Set();
2041
- if (seen.has(value)) {
2042
- return value;
2043
- }
2044
- seen.add(value);
2045
- depth--;
2046
- if (isRef(value)) {
2047
- traverse(value.value, depth, seen);
2048
- } else if (isArray(value)) {
2049
- for (let i = 0; i < value.length; i++) {
2050
- traverse(value[i], depth, seen);
2051
- }
2052
- } else if (isSet(value) || isMap(value)) {
2053
- value.forEach((v) => {
2054
- traverse(v, depth, seen);
2055
- });
2056
- } else if (isPlainObject(value)) {
2057
- for (const key in value) {
2058
- traverse(value[key], depth, seen);
2059
- }
2060
- }
2061
- return value;
1927
+ return ret;
2062
1928
  }
2063
1929
 
2064
- function validateDirectiveName(name) {
2065
- if (isBuiltInDirective(name)) {
2066
- warn$1("Do not use built-in directive ids as custom directive id: " + name);
2067
- }
2068
- }
2069
- function withDirectives(vnode, directives) {
2070
- if (currentRenderingInstance === null) {
2071
- !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
2072
- return vnode;
2073
- }
2074
- const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2075
- const bindings = vnode.dirs || (vnode.dirs = []);
2076
- for (let i = 0; i < directives.length; i++) {
2077
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2078
- if (dir) {
2079
- if (isFunction(dir)) {
2080
- dir = {
2081
- mounted: dir,
2082
- updated: dir
2083
- };
2084
- }
2085
- if (dir.deep) {
2086
- traverse(value);
1930
+ function createSlots(slots, dynamicSlots) {
1931
+ for (let i = 0; i < dynamicSlots.length; i++) {
1932
+ const slot = dynamicSlots[i];
1933
+ if (isArray(slot)) {
1934
+ for (let j = 0; j < slot.length; j++) {
1935
+ slots[slot[j].name] = slot[j].fn;
2087
1936
  }
2088
- bindings.push({
2089
- dir,
2090
- instance,
2091
- value,
2092
- oldValue: void 0,
2093
- arg,
2094
- modifiers
2095
- });
1937
+ } else if (slot) {
1938
+ slots[slot.name] = slot.key ? (...args) => {
1939
+ const res = slot.fn(...args);
1940
+ if (res) res.key = slot.key;
1941
+ return res;
1942
+ } : slot.fn;
2096
1943
  }
2097
1944
  }
2098
- return vnode;
1945
+ return slots;
2099
1946
  }
2100
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2101
- const bindings = vnode.dirs;
2102
- const oldBindings = prevVNode && prevVNode.dirs;
2103
- for (let i = 0; i < bindings.length; i++) {
2104
- const binding = bindings[i];
2105
- if (oldBindings) {
2106
- binding.oldValue = oldBindings[i].value;
2107
- }
2108
- let hook = binding.dir[name];
2109
- if (hook) {
2110
- pauseTracking();
2111
- callWithAsyncErrorHandling(hook, instance, 8, [
2112
- vnode.el,
2113
- binding,
2114
- vnode,
2115
- prevVNode
2116
- ]);
2117
- resetTracking();
2118
- }
2119
- }
1947
+
1948
+ /*! #__NO_SIDE_EFFECTS__ */
1949
+ // @__NO_SIDE_EFFECTS__
1950
+ function defineComponent(options, extraOptions) {
1951
+ return isFunction(options) ? (
1952
+ // #8326: extend call and options.name access are considered side-effects
1953
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1954
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
1955
+ ) : options;
2120
1956
  }
2121
1957
 
2122
- const leaveCbKey = Symbol("_leaveCb");
2123
- const enterCbKey = Symbol("_enterCb");
2124
- function useTransitionState() {
2125
- const state = {
2126
- isMounted: false,
2127
- isLeaving: false,
2128
- isUnmounting: false,
2129
- leavingVNodes: /* @__PURE__ */ new Map()
1958
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1959
+ /*! #__NO_SIDE_EFFECTS__ */
1960
+ // @__NO_SIDE_EFFECTS__
1961
+ function defineAsyncComponent(source) {
1962
+ if (isFunction(source)) {
1963
+ source = { loader: source };
1964
+ }
1965
+ const {
1966
+ loader,
1967
+ loadingComponent,
1968
+ errorComponent,
1969
+ delay = 200,
1970
+ timeout,
1971
+ // undefined = never times out
1972
+ suspensible = true,
1973
+ onError: userOnError
1974
+ } = source;
1975
+ let pendingRequest = null;
1976
+ let resolvedComp;
1977
+ let retries = 0;
1978
+ const retry = () => {
1979
+ retries++;
1980
+ pendingRequest = null;
1981
+ return load();
2130
1982
  };
2131
- onMounted(() => {
2132
- state.isMounted = true;
2133
- });
2134
- onBeforeUnmount(() => {
2135
- state.isUnmounting = true;
2136
- });
2137
- return state;
2138
- }
2139
- const TransitionHookValidator = [Function, Array];
2140
- const BaseTransitionPropsValidators = {
2141
- mode: String,
2142
- appear: Boolean,
2143
- persisted: Boolean,
2144
- // enter
2145
- onBeforeEnter: TransitionHookValidator,
2146
- onEnter: TransitionHookValidator,
2147
- onAfterEnter: TransitionHookValidator,
2148
- onEnterCancelled: TransitionHookValidator,
2149
- // leave
2150
- onBeforeLeave: TransitionHookValidator,
2151
- onLeave: TransitionHookValidator,
2152
- onAfterLeave: TransitionHookValidator,
2153
- onLeaveCancelled: TransitionHookValidator,
2154
- // appear
2155
- onBeforeAppear: TransitionHookValidator,
2156
- onAppear: TransitionHookValidator,
2157
- onAfterAppear: TransitionHookValidator,
2158
- onAppearCancelled: TransitionHookValidator
2159
- };
2160
- const BaseTransitionImpl = {
2161
- name: `BaseTransition`,
2162
- props: BaseTransitionPropsValidators,
2163
- setup(props, { slots }) {
2164
- const instance = getCurrentInstance();
2165
- const state = useTransitionState();
2166
- return () => {
2167
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
2168
- if (!children || !children.length) {
2169
- return;
2170
- }
2171
- let child = children[0];
2172
- if (children.length > 1) {
2173
- let hasFound = false;
2174
- for (const c of children) {
2175
- if (c.type !== Comment) {
2176
- if (!!(process.env.NODE_ENV !== "production") && hasFound) {
2177
- warn$1(
2178
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
2179
- );
2180
- break;
2181
- }
2182
- child = c;
2183
- hasFound = true;
2184
- if (!!!(process.env.NODE_ENV !== "production"))
2185
- break;
2186
- }
2187
- }
1983
+ const load = () => {
1984
+ let thisRequest;
1985
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1986
+ err = err instanceof Error ? err : new Error(String(err));
1987
+ if (userOnError) {
1988
+ return new Promise((resolve, reject) => {
1989
+ const userRetry = () => resolve(retry());
1990
+ const userFail = () => reject(err);
1991
+ userOnError(err, userRetry, userFail, retries + 1);
1992
+ });
1993
+ } else {
1994
+ throw err;
2188
1995
  }
2189
- const rawProps = toRaw(props);
2190
- const { mode } = rawProps;
2191
- if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
2192
- warn$1(`invalid <transition> mode: ${mode}`);
1996
+ }).then((comp) => {
1997
+ if (thisRequest !== pendingRequest && pendingRequest) {
1998
+ return pendingRequest;
2193
1999
  }
2194
- if (state.isLeaving) {
2195
- return emptyPlaceholder(child);
2000
+ if (!!(process.env.NODE_ENV !== "production") && !comp) {
2001
+ warn$1(
2002
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
2003
+ );
2196
2004
  }
2197
- const innerChild = getKeepAliveChild(child);
2198
- if (!innerChild) {
2199
- return emptyPlaceholder(child);
2005
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2006
+ comp = comp.default;
2200
2007
  }
2201
- const enterHooks = resolveTransitionHooks(
2202
- innerChild,
2203
- rawProps,
2204
- state,
2205
- instance
2206
- );
2207
- setTransitionHooks(innerChild, enterHooks);
2208
- const oldChild = instance.subTree;
2209
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2210
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
2211
- const leavingHooks = resolveTransitionHooks(
2212
- oldInnerChild,
2213
- rawProps,
2214
- state,
2215
- instance
2216
- );
2217
- setTransitionHooks(oldInnerChild, leavingHooks);
2218
- if (mode === "out-in" && innerChild.type !== Comment) {
2219
- state.isLeaving = true;
2220
- leavingHooks.afterLeave = () => {
2221
- state.isLeaving = false;
2222
- if (instance.update.active !== false) {
2223
- instance.effect.dirty = true;
2224
- instance.update();
2225
- }
2226
- };
2227
- return emptyPlaceholder(child);
2228
- } else if (mode === "in-out" && innerChild.type !== Comment) {
2229
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2230
- const leavingVNodesCache = getLeavingNodesForType(
2231
- state,
2232
- oldInnerChild
2233
- );
2234
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2235
- el[leaveCbKey] = () => {
2236
- earlyRemove();
2237
- el[leaveCbKey] = void 0;
2238
- delete enterHooks.delayedLeave;
2239
- };
2240
- enterHooks.delayedLeave = delayedLeave;
2241
- };
2242
- }
2008
+ if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) {
2009
+ throw new Error(`Invalid async component load result: ${comp}`);
2243
2010
  }
2244
- return child;
2245
- };
2246
- }
2247
- };
2248
- const BaseTransition = BaseTransitionImpl;
2249
- function getLeavingNodesForType(state, vnode) {
2250
- const { leavingVNodes } = state;
2251
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
2252
- if (!leavingVNodesCache) {
2253
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2254
- leavingVNodes.set(vnode.type, leavingVNodesCache);
2255
- }
2256
- return leavingVNodesCache;
2257
- }
2258
- function resolveTransitionHooks(vnode, props, state, instance) {
2259
- const {
2260
- appear,
2261
- mode,
2262
- persisted = false,
2263
- onBeforeEnter,
2264
- onEnter,
2265
- onAfterEnter,
2266
- onEnterCancelled,
2267
- onBeforeLeave,
2268
- onLeave,
2269
- onAfterLeave,
2270
- onLeaveCancelled,
2271
- onBeforeAppear,
2272
- onAppear,
2273
- onAfterAppear,
2274
- onAppearCancelled
2275
- } = props;
2276
- const key = String(vnode.key);
2277
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2278
- const callHook = (hook, args) => {
2279
- hook && callWithAsyncErrorHandling(
2280
- hook,
2281
- instance,
2282
- 9,
2283
- args
2284
- );
2285
- };
2286
- const callAsyncHook = (hook, args) => {
2287
- const done = args[1];
2288
- callHook(hook, args);
2289
- if (isArray(hook)) {
2290
- if (hook.every((hook2) => hook2.length <= 1))
2291
- done();
2292
- } else if (hook.length <= 1) {
2293
- done();
2294
- }
2011
+ resolvedComp = comp;
2012
+ return comp;
2013
+ }));
2295
2014
  };
2296
- const hooks = {
2297
- mode,
2298
- persisted,
2299
- beforeEnter(el) {
2300
- let hook = onBeforeEnter;
2301
- if (!state.isMounted) {
2302
- if (appear) {
2303
- hook = onBeforeAppear || onBeforeEnter;
2304
- } else {
2305
- return;
2306
- }
2015
+ return defineComponent({
2016
+ name: "AsyncComponentWrapper",
2017
+ __asyncLoader: load,
2018
+ get __asyncResolved() {
2019
+ return resolvedComp;
2020
+ },
2021
+ setup() {
2022
+ const instance = currentInstance;
2023
+ if (resolvedComp) {
2024
+ return () => createInnerComp(resolvedComp, instance);
2307
2025
  }
2308
- if (el[leaveCbKey]) {
2309
- el[leaveCbKey](
2310
- true
2311
- /* cancelled */
2026
+ const onError = (err) => {
2027
+ pendingRequest = null;
2028
+ handleError(
2029
+ err,
2030
+ instance,
2031
+ 13,
2032
+ !errorComponent
2312
2033
  );
2034
+ };
2035
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
2036
+ return load().then((comp) => {
2037
+ return () => createInnerComp(comp, instance);
2038
+ }).catch((err) => {
2039
+ onError(err);
2040
+ return () => errorComponent ? createVNode(errorComponent, {
2041
+ error: err
2042
+ }) : null;
2043
+ });
2313
2044
  }
2314
- const leavingVNode = leavingVNodesCache[key];
2315
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
2316
- leavingVNode.el[leaveCbKey]();
2045
+ const loaded = ref(false);
2046
+ const error = ref();
2047
+ const delayed = ref(!!delay);
2048
+ if (delay) {
2049
+ setTimeout(() => {
2050
+ delayed.value = false;
2051
+ }, delay);
2317
2052
  }
2318
- callHook(hook, [el]);
2319
- },
2320
- enter(el) {
2321
- let hook = onEnter;
2322
- let afterHook = onAfterEnter;
2323
- let cancelHook = onEnterCancelled;
2324
- if (!state.isMounted) {
2325
- if (appear) {
2326
- hook = onAppear || onEnter;
2327
- afterHook = onAfterAppear || onAfterEnter;
2328
- cancelHook = onAppearCancelled || onEnterCancelled;
2329
- } else {
2330
- return;
2331
- }
2053
+ if (timeout != null) {
2054
+ setTimeout(() => {
2055
+ if (!loaded.value && !error.value) {
2056
+ const err = new Error(
2057
+ `Async component timed out after ${timeout}ms.`
2058
+ );
2059
+ onError(err);
2060
+ error.value = err;
2061
+ }
2062
+ }, timeout);
2332
2063
  }
2333
- let called = false;
2334
- const done = el[enterCbKey] = (cancelled) => {
2335
- if (called)
2336
- return;
2337
- called = true;
2338
- if (cancelled) {
2339
- callHook(cancelHook, [el]);
2340
- } else {
2341
- callHook(afterHook, [el]);
2342
- }
2343
- if (hooks.delayedLeave) {
2344
- hooks.delayedLeave();
2345
- }
2346
- el[enterCbKey] = void 0;
2347
- };
2348
- if (hook) {
2349
- callAsyncHook(hook, [el, done]);
2350
- } else {
2351
- done();
2352
- }
2353
- },
2354
- leave(el, remove) {
2355
- const key2 = String(vnode.key);
2356
- if (el[enterCbKey]) {
2357
- el[enterCbKey](
2358
- true
2359
- /* cancelled */
2360
- );
2361
- }
2362
- if (state.isUnmounting) {
2363
- return remove();
2364
- }
2365
- callHook(onBeforeLeave, [el]);
2366
- let called = false;
2367
- const done = el[leaveCbKey] = (cancelled) => {
2368
- if (called)
2369
- return;
2370
- called = true;
2371
- remove();
2372
- if (cancelled) {
2373
- callHook(onLeaveCancelled, [el]);
2374
- } else {
2375
- callHook(onAfterLeave, [el]);
2376
- }
2377
- el[leaveCbKey] = void 0;
2378
- if (leavingVNodesCache[key2] === vnode) {
2379
- delete leavingVNodesCache[key2];
2380
- }
2381
- };
2382
- leavingVNodesCache[key2] = vnode;
2383
- if (onLeave) {
2384
- callAsyncHook(onLeave, [el, done]);
2385
- } else {
2386
- done();
2387
- }
2388
- },
2389
- clone(vnode2) {
2390
- return resolveTransitionHooks(vnode2, props, state, instance);
2391
- }
2392
- };
2393
- return hooks;
2394
- }
2395
- function emptyPlaceholder(vnode) {
2396
- if (isKeepAlive(vnode)) {
2397
- vnode = cloneVNode(vnode);
2398
- vnode.children = null;
2399
- return vnode;
2400
- }
2401
- }
2402
- function getKeepAliveChild(vnode) {
2403
- if (!isKeepAlive(vnode)) {
2404
- return vnode;
2405
- }
2406
- if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
2407
- return vnode.component.subTree;
2408
- }
2409
- const { shapeFlag, children } = vnode;
2410
- if (children) {
2411
- if (shapeFlag & 16) {
2412
- return children[0];
2413
- }
2414
- if (shapeFlag & 32 && isFunction(children.default)) {
2415
- return children.default();
2416
- }
2417
- }
2418
- }
2419
- function setTransitionHooks(vnode, hooks) {
2420
- if (vnode.shapeFlag & 6 && vnode.component) {
2421
- setTransitionHooks(vnode.component.subTree, hooks);
2422
- } else if (vnode.shapeFlag & 128) {
2423
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2424
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2425
- } else {
2426
- vnode.transition = hooks;
2427
- }
2428
- }
2429
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
2430
- let ret = [];
2431
- let keyedFragmentCount = 0;
2432
- for (let i = 0; i < children.length; i++) {
2433
- let child = children[i];
2434
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2435
- if (child.type === Fragment) {
2436
- if (child.patchFlag & 128)
2437
- keyedFragmentCount++;
2438
- ret = ret.concat(
2439
- getTransitionRawChildren(child.children, keepComment, key)
2440
- );
2441
- } else if (keepComment || child.type !== Comment) {
2442
- ret.push(key != null ? cloneVNode(child, { key }) : child);
2443
- }
2444
- }
2445
- if (keyedFragmentCount > 1) {
2446
- for (let i = 0; i < ret.length; i++) {
2447
- ret[i].patchFlag = -2;
2448
- }
2449
- }
2450
- return ret;
2451
- }
2452
-
2453
- /*! #__NO_SIDE_EFFECTS__ */
2454
- // @__NO_SIDE_EFFECTS__
2455
- function defineComponent(options, extraOptions) {
2456
- return isFunction(options) ? (
2457
- // #8326: extend call and options.name access are considered side-effects
2458
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2459
- /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
2460
- ) : options;
2461
- }
2462
-
2463
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2464
- /*! #__NO_SIDE_EFFECTS__ */
2465
- // @__NO_SIDE_EFFECTS__
2466
- function defineAsyncComponent(source) {
2467
- if (isFunction(source)) {
2468
- source = { loader: source };
2469
- }
2470
- const {
2471
- loader,
2472
- loadingComponent,
2473
- errorComponent,
2474
- delay = 200,
2475
- timeout,
2476
- // undefined = never times out
2477
- suspensible = true,
2478
- onError: userOnError
2479
- } = source;
2480
- let pendingRequest = null;
2481
- let resolvedComp;
2482
- let retries = 0;
2483
- const retry = () => {
2484
- retries++;
2485
- pendingRequest = null;
2486
- return load();
2487
- };
2488
- const load = () => {
2489
- let thisRequest;
2490
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2491
- err = err instanceof Error ? err : new Error(String(err));
2492
- if (userOnError) {
2493
- return new Promise((resolve, reject) => {
2494
- const userRetry = () => resolve(retry());
2495
- const userFail = () => reject(err);
2496
- userOnError(err, userRetry, userFail, retries + 1);
2497
- });
2498
- } else {
2499
- throw err;
2500
- }
2501
- }).then((comp) => {
2502
- if (thisRequest !== pendingRequest && pendingRequest) {
2503
- return pendingRequest;
2504
- }
2505
- if (!!(process.env.NODE_ENV !== "production") && !comp) {
2506
- warn$1(
2507
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
2508
- );
2509
- }
2510
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2511
- comp = comp.default;
2512
- }
2513
- if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) {
2514
- throw new Error(`Invalid async component load result: ${comp}`);
2515
- }
2516
- resolvedComp = comp;
2517
- return comp;
2518
- }));
2519
- };
2520
- return defineComponent({
2521
- name: "AsyncComponentWrapper",
2522
- __asyncLoader: load,
2523
- get __asyncResolved() {
2524
- return resolvedComp;
2525
- },
2526
- setup() {
2527
- const instance = currentInstance;
2528
- if (resolvedComp) {
2529
- return () => createInnerComp(resolvedComp, instance);
2530
- }
2531
- const onError = (err) => {
2532
- pendingRequest = null;
2533
- handleError(
2534
- err,
2535
- instance,
2536
- 13,
2537
- !errorComponent
2538
- );
2539
- };
2540
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
2541
- return load().then((comp) => {
2542
- return () => createInnerComp(comp, instance);
2543
- }).catch((err) => {
2544
- onError(err);
2545
- return () => errorComponent ? createVNode(errorComponent, {
2546
- error: err
2547
- }) : null;
2548
- });
2549
- }
2550
- const loaded = ref(false);
2551
- const error = ref();
2552
- const delayed = ref(!!delay);
2553
- if (delay) {
2554
- setTimeout(() => {
2555
- delayed.value = false;
2556
- }, delay);
2557
- }
2558
- if (timeout != null) {
2559
- setTimeout(() => {
2560
- if (!loaded.value && !error.value) {
2561
- const err = new Error(
2562
- `Async component timed out after ${timeout}ms.`
2563
- );
2564
- onError(err);
2565
- error.value = err;
2566
- }
2567
- }, timeout);
2568
- }
2569
- load().then(() => {
2570
- loaded.value = true;
2571
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2572
- instance.parent.effect.dirty = true;
2573
- queueJob(instance.parent.update);
2064
+ load().then(() => {
2065
+ loaded.value = true;
2066
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2067
+ instance.parent.effect.dirty = true;
2068
+ queueJob(instance.parent.update);
2574
2069
  }
2575
2070
  }).catch((err) => {
2576
2071
  onError(err);
@@ -2599,418 +2094,49 @@ function createInnerComp(comp, parent) {
2599
2094
  return vnode;
2600
2095
  }
2601
2096
 
2602
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2603
- const KeepAliveImpl = {
2604
- name: `KeepAlive`,
2605
- // Marker for special handling inside the renderer. We are not using a ===
2606
- // check directly on KeepAlive in the renderer, because importing it directly
2607
- // would prevent it from being tree-shaken.
2608
- __isKeepAlive: true,
2609
- props: {
2610
- include: [String, RegExp, Array],
2611
- exclude: [String, RegExp, Array],
2612
- max: [String, Number]
2613
- },
2614
- setup(props, { slots }) {
2615
- const instance = getCurrentInstance();
2616
- const sharedContext = instance.ctx;
2617
- if (!sharedContext.renderer) {
2618
- return () => {
2619
- const children = slots.default && slots.default();
2620
- return children && children.length === 1 ? children[0] : children;
2621
- };
2622
- }
2623
- const cache = /* @__PURE__ */ new Map();
2624
- const keys = /* @__PURE__ */ new Set();
2625
- let current = null;
2626
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
2627
- instance.__v_cache = cache;
2628
- }
2629
- const parentSuspense = instance.suspense;
2630
- const {
2631
- renderer: {
2632
- p: patch,
2633
- m: move,
2634
- um: _unmount,
2635
- o: { createElement }
2636
- }
2637
- } = sharedContext;
2638
- const storageContainer = createElement("div");
2639
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2640
- const instance2 = vnode.component;
2641
- move(vnode, container, anchor, 0, parentSuspense);
2642
- patch(
2643
- instance2.vnode,
2644
- vnode,
2645
- container,
2646
- anchor,
2647
- instance2,
2648
- parentSuspense,
2649
- namespace,
2650
- vnode.slotScopeIds,
2651
- optimized
2652
- );
2653
- queuePostRenderEffect(() => {
2654
- instance2.isDeactivated = false;
2655
- if (instance2.a) {
2656
- invokeArrayFns(instance2.a);
2657
- }
2658
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2659
- if (vnodeHook) {
2660
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2661
- }
2662
- }, parentSuspense);
2663
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
2664
- devtoolsComponentAdded(instance2);
2665
- }
2666
- };
2667
- sharedContext.deactivate = (vnode) => {
2668
- const instance2 = vnode.component;
2669
- move(vnode, storageContainer, null, 1, parentSuspense);
2670
- queuePostRenderEffect(() => {
2671
- if (instance2.da) {
2672
- invokeArrayFns(instance2.da);
2673
- }
2674
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2675
- if (vnodeHook) {
2676
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2677
- }
2678
- instance2.isDeactivated = true;
2679
- }, parentSuspense);
2680
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
2681
- devtoolsComponentAdded(instance2);
2682
- }
2683
- };
2684
- function unmount(vnode) {
2685
- resetShapeFlag(vnode);
2686
- _unmount(vnode, instance, parentSuspense, true);
2687
- }
2688
- function pruneCache(filter) {
2689
- cache.forEach((vnode, key) => {
2690
- const name = getComponentName(vnode.type);
2691
- if (name && (!filter || !filter(name))) {
2692
- pruneCacheEntry(key);
2693
- }
2694
- });
2695
- }
2696
- function pruneCacheEntry(key) {
2697
- const cached = cache.get(key);
2698
- if (!current || !isSameVNodeType(cached, current)) {
2699
- unmount(cached);
2700
- } else if (current) {
2701
- resetShapeFlag(current);
2702
- }
2703
- cache.delete(key);
2704
- keys.delete(key);
2705
- }
2706
- watch(
2707
- () => [props.include, props.exclude],
2708
- ([include, exclude]) => {
2709
- include && pruneCache((name) => matches(include, name));
2710
- exclude && pruneCache((name) => !matches(exclude, name));
2711
- },
2712
- // prune post-render after `current` has been updated
2713
- { flush: "post", deep: true }
2714
- );
2715
- let pendingCacheKey = null;
2716
- const cacheSubtree = () => {
2717
- if (pendingCacheKey != null) {
2718
- if (isSuspense(instance.subTree.type)) {
2719
- queuePostRenderEffect(() => {
2720
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2721
- }, instance.subTree.suspense);
2722
- } else {
2723
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2724
- }
2725
- }
2726
- };
2727
- onMounted(cacheSubtree);
2728
- onUpdated(cacheSubtree);
2729
- onBeforeUnmount(() => {
2730
- cache.forEach((cached) => {
2731
- const { subTree, suspense } = instance;
2732
- const vnode = getInnerChild(subTree);
2733
- if (cached.type === vnode.type && cached.key === vnode.key) {
2734
- resetShapeFlag(vnode);
2735
- const da = vnode.component.da;
2736
- da && queuePostRenderEffect(da, suspense);
2737
- return;
2738
- }
2739
- unmount(cached);
2740
- });
2741
- });
2742
- return () => {
2743
- pendingCacheKey = null;
2744
- if (!slots.default) {
2745
- return null;
2746
- }
2747
- const children = slots.default();
2748
- const rawVNode = children[0];
2749
- if (children.length > 1) {
2750
- if (!!(process.env.NODE_ENV !== "production")) {
2751
- warn$1(`KeepAlive should contain exactly one component child.`);
2752
- }
2753
- current = null;
2754
- return children;
2755
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2756
- current = null;
2757
- return rawVNode;
2758
- }
2759
- let vnode = getInnerChild(rawVNode);
2760
- const comp = vnode.type;
2761
- const name = getComponentName(
2762
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2763
- );
2764
- const { include, exclude, max } = props;
2765
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2766
- current = vnode;
2767
- return rawVNode;
2768
- }
2769
- const key = vnode.key == null ? comp : vnode.key;
2770
- const cachedVNode = cache.get(key);
2771
- if (vnode.el) {
2772
- vnode = cloneVNode(vnode);
2773
- if (rawVNode.shapeFlag & 128) {
2774
- rawVNode.ssContent = vnode;
2775
- }
2776
- }
2777
- pendingCacheKey = key;
2778
- if (cachedVNode) {
2779
- vnode.el = cachedVNode.el;
2780
- vnode.component = cachedVNode.component;
2781
- if (vnode.transition) {
2782
- setTransitionHooks(vnode, vnode.transition);
2783
- }
2784
- vnode.shapeFlag |= 512;
2785
- keys.delete(key);
2786
- keys.add(key);
2787
- } else {
2788
- keys.add(key);
2789
- if (max && keys.size > parseInt(max, 10)) {
2790
- pruneCacheEntry(keys.values().next().value);
2791
- }
2792
- }
2793
- vnode.shapeFlag |= 256;
2794
- current = vnode;
2795
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
2796
- };
2097
+ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2098
+ if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2099
+ if (name !== "default") props.name = name;
2100
+ return createVNode("slot", props, fallback && fallback());
2797
2101
  }
2798
- };
2799
- const KeepAlive = KeepAliveImpl;
2800
- function matches(pattern, name) {
2801
- if (isArray(pattern)) {
2802
- return pattern.some((p) => matches(p, name));
2803
- } else if (isString(pattern)) {
2804
- return pattern.split(",").includes(name);
2805
- } else if (isRegExp(pattern)) {
2806
- return pattern.test(name);
2102
+ let slot = slots[name];
2103
+ if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
2104
+ warn$1(
2105
+ `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
2106
+ );
2107
+ slot = () => [];
2807
2108
  }
2808
- return false;
2809
- }
2810
- function onActivated(hook, target) {
2811
- registerKeepAliveHook(hook, "a", target);
2812
- }
2813
- function onDeactivated(hook, target) {
2814
- registerKeepAliveHook(hook, "da", target);
2815
- }
2816
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2817
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2818
- let current = target;
2819
- while (current) {
2820
- if (current.isDeactivated) {
2821
- return;
2822
- }
2823
- current = current.parent;
2824
- }
2825
- return hook();
2826
- });
2827
- injectHook(type, wrappedHook, target);
2828
- if (target) {
2829
- let current = target.parent;
2830
- while (current && current.parent) {
2831
- if (isKeepAlive(current.parent.vnode)) {
2832
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2833
- }
2834
- current = current.parent;
2835
- }
2109
+ if (slot && slot._c) {
2110
+ slot._d = false;
2836
2111
  }
2837
- }
2838
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2839
- const injected = injectHook(
2840
- type,
2841
- hook,
2842
- keepAliveRoot,
2843
- true
2844
- /* prepend */
2112
+ openBlock();
2113
+ const validSlotContent = slot && ensureValidVNode(slot(props));
2114
+ const rendered = createBlock(
2115
+ Fragment,
2116
+ {
2117
+ key: props.key || // slot content array of a dynamic conditional slot may have a branch
2118
+ // key attached in the `createSlots` helper, respect that
2119
+ validSlotContent && validSlotContent.key || `_${name}`
2120
+ },
2121
+ validSlotContent || (fallback ? fallback() : []),
2122
+ validSlotContent && slots._ === 1 ? 64 : -2
2845
2123
  );
2846
- onUnmounted(() => {
2847
- remove(keepAliveRoot[type], injected);
2848
- }, target);
2849
- }
2850
- function resetShapeFlag(vnode) {
2851
- vnode.shapeFlag &= ~256;
2852
- vnode.shapeFlag &= ~512;
2124
+ if (!noSlotted && rendered.scopeId) {
2125
+ rendered.slotScopeIds = [rendered.scopeId + "-s"];
2126
+ }
2127
+ if (slot && slot._c) {
2128
+ slot._d = true;
2129
+ }
2130
+ return rendered;
2853
2131
  }
2854
- function getInnerChild(vnode) {
2855
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2856
- }
2857
-
2858
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2859
- if (target) {
2860
- const hooks = target[type] || (target[type] = []);
2861
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2862
- if (target.isUnmounted) {
2863
- return;
2864
- }
2865
- pauseTracking();
2866
- const reset = setCurrentInstance(target);
2867
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2868
- reset();
2869
- resetTracking();
2870
- return res;
2871
- });
2872
- if (prepend) {
2873
- hooks.unshift(wrappedHook);
2874
- } else {
2875
- hooks.push(wrappedHook);
2876
- }
2877
- return wrappedHook;
2878
- } else if (!!(process.env.NODE_ENV !== "production")) {
2879
- const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
2880
- warn$1(
2881
- `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
2882
- );
2883
- }
2884
- }
2885
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
2886
- if (!isInSSRComponentSetup || lifecycle === "sp") {
2887
- injectHook(lifecycle, (...args) => hook(...args), target);
2888
- }
2889
- if (lifecycle === "m" && (target == null ? void 0 : target.isMounted)) {
2890
- hook();
2891
- }
2892
- };
2893
- const onBeforeMount = createHook("bm");
2894
- const onMounted = createHook("m");
2895
- const onBeforeUpdate = createHook("bu");
2896
- const onUpdated = createHook("u");
2897
- const onBeforeUnmount = createHook("bum");
2898
- const onUnmounted = createHook("um");
2899
- const onServerPrefetch = createHook("sp");
2900
- const onRenderTriggered = createHook(
2901
- "rtg"
2902
- );
2903
- const onRenderTracked = createHook(
2904
- "rtc"
2905
- );
2906
- function onErrorCaptured(hook, target = currentInstance) {
2907
- injectHook("ec", hook, target);
2908
- }
2909
-
2910
- function renderList(source, renderItem, cache, index) {
2911
- let ret;
2912
- const cached = cache && cache[index];
2913
- if (isArray(source) || isString(source)) {
2914
- ret = new Array(source.length);
2915
- for (let i = 0, l = source.length; i < l; i++) {
2916
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
2917
- }
2918
- } else if (typeof source === "number") {
2919
- if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
2920
- warn$1(`The v-for range expect an integer value but got ${source}.`);
2921
- }
2922
- ret = new Array(source);
2923
- for (let i = 0; i < source; i++) {
2924
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2925
- }
2926
- } else if (isObject(source)) {
2927
- if (source[Symbol.iterator]) {
2928
- ret = Array.from(
2929
- source,
2930
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
2931
- );
2932
- } else {
2933
- const keys = Object.keys(source);
2934
- ret = new Array(keys.length);
2935
- for (let i = 0, l = keys.length; i < l; i++) {
2936
- const key = keys[i];
2937
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2938
- }
2939
- }
2940
- } else {
2941
- ret = [];
2942
- }
2943
- if (cache) {
2944
- cache[index] = ret;
2945
- }
2946
- return ret;
2947
- }
2948
-
2949
- function createSlots(slots, dynamicSlots) {
2950
- for (let i = 0; i < dynamicSlots.length; i++) {
2951
- const slot = dynamicSlots[i];
2952
- if (isArray(slot)) {
2953
- for (let j = 0; j < slot.length; j++) {
2954
- slots[slot[j].name] = slot[j].fn;
2955
- }
2956
- } else if (slot) {
2957
- slots[slot.name] = slot.key ? (...args) => {
2958
- const res = slot.fn(...args);
2959
- if (res)
2960
- res.key = slot.key;
2961
- return res;
2962
- } : slot.fn;
2963
- }
2964
- }
2965
- return slots;
2966
- }
2967
-
2968
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2969
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2970
- if (name !== "default")
2971
- props.name = name;
2972
- return createVNode("slot", props, fallback && fallback());
2973
- }
2974
- let slot = slots[name];
2975
- if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
2976
- warn$1(
2977
- `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
2978
- );
2979
- slot = () => [];
2980
- }
2981
- if (slot && slot._c) {
2982
- slot._d = false;
2983
- }
2984
- openBlock();
2985
- const validSlotContent = slot && ensureValidVNode(slot(props));
2986
- const rendered = createBlock(
2987
- Fragment,
2988
- {
2989
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
2990
- // key attached in the `createSlots` helper, respect that
2991
- validSlotContent && validSlotContent.key || `_${name}`
2992
- },
2993
- validSlotContent || (fallback ? fallback() : []),
2994
- validSlotContent && slots._ === 1 ? 64 : -2
2995
- );
2996
- if (!noSlotted && rendered.scopeId) {
2997
- rendered.slotScopeIds = [rendered.scopeId + "-s"];
2998
- }
2999
- if (slot && slot._c) {
3000
- slot._d = true;
3001
- }
3002
- return rendered;
3003
- }
3004
- function ensureValidVNode(vnodes) {
3005
- return vnodes.some((child) => {
3006
- if (!isVNode(child))
3007
- return true;
3008
- if (child.type === Comment)
3009
- return false;
3010
- if (child.type === Fragment && !ensureValidVNode(child.children))
3011
- return false;
3012
- return true;
3013
- }) ? vnodes : null;
2132
+ function ensureValidVNode(vnodes) {
2133
+ return vnodes.some((child) => {
2134
+ if (!isVNode(child)) return true;
2135
+ if (child.type === Comment) return false;
2136
+ if (child.type === Fragment && !ensureValidVNode(child.children))
2137
+ return false;
2138
+ return true;
2139
+ }) ? vnodes : null;
3014
2140
  }
3015
2141
 
3016
2142
  function toHandlers(obj, preserveCaseIfNecessary) {
@@ -3026,10 +2152,8 @@ function toHandlers(obj, preserveCaseIfNecessary) {
3026
2152
  }
3027
2153
 
3028
2154
  const getPublicInstance = (i) => {
3029
- if (!i)
3030
- return null;
3031
- if (isStatefulComponent(i))
3032
- return getExposeProxy(i) || i.proxy;
2155
+ if (!i) return null;
2156
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
3033
2157
  return getPublicInstance(i.parent);
3034
2158
  };
3035
2159
  const publicPropertiesMap = (
@@ -3341,8 +2465,7 @@ function normalizePropsOrEmits(props) {
3341
2465
  function mergeDefaults(raw, defaults) {
3342
2466
  const props = normalizePropsOrEmits(raw);
3343
2467
  for (const key in defaults) {
3344
- if (key.startsWith("__skip"))
3345
- continue;
2468
+ if (key.startsWith("__skip")) continue;
3346
2469
  let opt = props[key];
3347
2470
  if (opt) {
3348
2471
  if (isArray(opt) || isFunction(opt)) {
@@ -3362,10 +2485,8 @@ function mergeDefaults(raw, defaults) {
3362
2485
  return props;
3363
2486
  }
3364
2487
  function mergeModels(a, b) {
3365
- if (!a || !b)
3366
- return a || b;
3367
- if (isArray(a) && isArray(b))
3368
- return a.concat(b);
2488
+ if (!a || !b) return a || b;
2489
+ if (isArray(a) && isArray(b)) return a.concat(b);
3369
2490
  return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
3370
2491
  }
3371
2492
  function createPropsRestProxy(props, excludedKeys) {
@@ -3597,10 +2718,8 @@ function applyOptions(instance) {
3597
2718
  if (inheritAttrs != null) {
3598
2719
  instance.inheritAttrs = inheritAttrs;
3599
2720
  }
3600
- if (components)
3601
- instance.components = components;
3602
- if (directives)
3603
- instance.directives = directives;
2721
+ if (components) instance.components = components;
2722
+ if (directives) instance.directives = directives;
3604
2723
  }
3605
2724
  function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
3606
2725
  if (isArray(injectOptions)) {
@@ -3801,10 +2920,8 @@ function mergeEmitsOrPropsOptions(to, from) {
3801
2920
  }
3802
2921
  }
3803
2922
  function mergeWatchOptions(to, from) {
3804
- if (!to)
3805
- return from;
3806
- if (!from)
3807
- return to;
2923
+ if (!to) return from;
2924
+ if (!from) return to;
3808
2925
  const merged = extend(/* @__PURE__ */ Object.create(null), to);
3809
2926
  for (const key in from) {
3810
2927
  merged[key] = mergeAsArray(to[key], from[key]);
@@ -3956,7 +3073,7 @@ function createAppAPI(render, hydrate) {
3956
3073
  app._instance = vnode.component;
3957
3074
  devtoolsInitApp(app, version);
3958
3075
  }
3959
- return getExposeProxy(vnode.component) || vnode.component.proxy;
3076
+ return getComponentPublicInstance(vnode.component);
3960
3077
  } else if (!!(process.env.NODE_ENV !== "production")) {
3961
3078
  warn$1(
3962
3079
  `App has already been mounted.
@@ -4063,8 +3180,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
4063
3180
  }
4064
3181
  function isInHmrContext(instance) {
4065
3182
  while (instance) {
4066
- if (instance.type.__hmrId)
4067
- return true;
3183
+ if (instance.type.__hmrId) return true;
4068
3184
  instance = instance.parent;
4069
3185
  }
4070
3186
  }
@@ -4249,8 +3365,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4249
3365
  hasExtends = true;
4250
3366
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
4251
3367
  extend(normalized, props);
4252
- if (keys)
4253
- needCastKeys.push(...keys);
3368
+ if (keys) needCastKeys.push(...keys);
4254
3369
  };
4255
3370
  if (!asMixin && appContext.mixins.length) {
4256
3371
  appContext.mixins.forEach(extendProps);
@@ -4341,8 +3456,7 @@ function validateProps(rawProps, props, instance) {
4341
3456
  const options = instance.propsOptions[0];
4342
3457
  for (const key in options) {
4343
3458
  let opt = options[key];
4344
- if (opt == null)
4345
- continue;
3459
+ if (opt == null) continue;
4346
3460
  validateProp(
4347
3461
  key,
4348
3462
  resolvedValues[key],
@@ -4460,8 +3574,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4460
3574
  const normalizeObjectSlots = (rawSlots, slots, instance) => {
4461
3575
  const ctx = rawSlots._ctx;
4462
3576
  for (const key in rawSlots) {
4463
- if (isInternalKey(key))
4464
- continue;
3577
+ if (isInternalKey(key)) continue;
4465
3578
  const value = rawSlots[key];
4466
3579
  if (isFunction(value)) {
4467
3580
  slots[key] = normalizeSlot(key, value, ctx);
@@ -4551,7 +3664,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4551
3664
  if (isAsyncWrapper(vnode) && !isUnmount) {
4552
3665
  return;
4553
3666
  }
4554
- const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
3667
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
4555
3668
  const value = isUnmount ? null : refValue;
4556
3669
  const { i: owner, r: ref } = rawRef;
4557
3670
  if (!!(process.env.NODE_ENV !== "production") && !owner) {
@@ -4593,8 +3706,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4593
3706
  }
4594
3707
  } else {
4595
3708
  ref.value = [refValue];
4596
- if (rawRef.k)
4597
- refs[rawRef.k] = ref.value;
3709
+ if (rawRef.k) refs[rawRef.k] = ref.value;
4598
3710
  }
4599
3711
  } else if (!existing.includes(refValue)) {
4600
3712
  existing.push(refValue);
@@ -4607,8 +3719,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4607
3719
  }
4608
3720
  } else if (_isRef) {
4609
3721
  ref.value = value;
4610
- if (rawRef.k)
4611
- refs[rawRef.k] = value;
3722
+ if (rawRef.k) refs[rawRef.k] = value;
4612
3723
  } else if (!!(process.env.NODE_ENV !== "production")) {
4613
3724
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4614
3725
  }
@@ -4625,14 +3736,19 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4625
3736
  }
4626
3737
  }
4627
3738
 
4628
- let hasMismatch = false;
3739
+ let hasLoggedMismatchError = false;
3740
+ const logMismatchError = () => {
3741
+ if (hasLoggedMismatchError) {
3742
+ return;
3743
+ }
3744
+ console.error("Hydration completed but contains mismatches.");
3745
+ hasLoggedMismatchError = true;
3746
+ };
4629
3747
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4630
3748
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4631
3749
  const getContainerType = (container) => {
4632
- if (isSVGContainer(container))
4633
- return "svg";
4634
- if (isMathMLContainer(container))
4635
- return "mathml";
3750
+ if (isSVGContainer(container)) return "svg";
3751
+ if (isMathMLContainer(container)) return "mathml";
4636
3752
  return void 0;
4637
3753
  };
4638
3754
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -4660,13 +3776,9 @@ function createHydrationFunctions(rendererInternals) {
4660
3776
  container._vnode = vnode;
4661
3777
  return;
4662
3778
  }
4663
- hasMismatch = false;
4664
3779
  hydrateNode(container.firstChild, vnode, null, null, null);
4665
3780
  flushPostFlushCbs();
4666
3781
  container._vnode = vnode;
4667
- if (hasMismatch && true) {
4668
- console.error(`Hydration completed but contains mismatches.`);
4669
- }
4670
3782
  };
4671
3783
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
4672
3784
  optimized = optimized || !!vnode.dynamicChildren;
@@ -4683,18 +3795,8 @@ function createHydrationFunctions(rendererInternals) {
4683
3795
  let domType = node.nodeType;
4684
3796
  vnode.el = node;
4685
3797
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4686
- if (!("__vnode" in node)) {
4687
- Object.defineProperty(node, "__vnode", {
4688
- value: vnode,
4689
- enumerable: false
4690
- });
4691
- }
4692
- if (!("__vueParentComponent" in node)) {
4693
- Object.defineProperty(node, "__vueParentComponent", {
4694
- value: parentComponent,
4695
- enumerable: false
4696
- });
4697
- }
3798
+ def(node, "__vnode", vnode, true);
3799
+ def(node, "__vueParentComponent", parentComponent, true);
4698
3800
  }
4699
3801
  if (patchFlag === -2) {
4700
3802
  optimized = false;
@@ -4712,7 +3814,6 @@ function createHydrationFunctions(rendererInternals) {
4712
3814
  }
4713
3815
  } else {
4714
3816
  if (node.data !== vnode.children) {
4715
- hasMismatch = true;
4716
3817
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4717
3818
  `Hydration text mismatch in`,
4718
3819
  node.parentNode,
@@ -4722,6 +3823,7 @@ function createHydrationFunctions(rendererInternals) {
4722
3823
  )}
4723
3824
  - expected on client: ${JSON.stringify(vnode.children)}`
4724
3825
  );
3826
+ logMismatchError();
4725
3827
  node.data = vnode.children;
4726
3828
  }
4727
3829
  nextNode = nextSibling(node);
@@ -4887,7 +3989,6 @@ function createHydrationFunctions(rendererInternals) {
4887
3989
  );
4888
3990
  let hasWarned = false;
4889
3991
  while (next) {
4890
- hasMismatch = true;
4891
3992
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4892
3993
  warn$1(
4893
3994
  `Hydration children mismatch on`,
@@ -4897,13 +3998,13 @@ Server rendered element contains more child nodes than client vdom.`
4897
3998
  );
4898
3999
  hasWarned = true;
4899
4000
  }
4001
+ logMismatchError();
4900
4002
  const cur = next;
4901
4003
  next = next.nextSibling;
4902
4004
  remove(cur);
4903
4005
  }
4904
4006
  } else if (shapeFlag & 8) {
4905
4007
  if (el.textContent !== vnode.children) {
4906
- hasMismatch = true;
4907
4008
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4908
4009
  `Hydration text content mismatch on`,
4909
4010
  el,
@@ -4911,14 +4012,17 @@ Server rendered element contains more child nodes than client vdom.`
4911
4012
  - rendered on server: ${el.textContent}
4912
4013
  - expected on client: ${vnode.children}`
4913
4014
  );
4015
+ logMismatchError();
4914
4016
  el.textContent = vnode.children;
4915
4017
  }
4916
4018
  }
4917
4019
  if (props) {
4918
4020
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
4919
4021
  for (const key in props) {
4920
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
4921
- hasMismatch = true;
4022
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
4023
+ // as it could have mutated the DOM in any possible way
4024
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
4025
+ logMismatchError();
4922
4026
  }
4923
4027
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4924
4028
  key[0] === ".") {
@@ -4981,7 +4085,6 @@ Server rendered element contains more child nodes than client vdom.`
4981
4085
  } else if (vnode.type === Text && !vnode.children) {
4982
4086
  insert(vnode.el = createText(""), container);
4983
4087
  } else {
4984
- hasMismatch = true;
4985
4088
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4986
4089
  warn$1(
4987
4090
  `Hydration children mismatch on`,
@@ -4991,6 +4094,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4991
4094
  );
4992
4095
  hasWarned = true;
4993
4096
  }
4097
+ logMismatchError();
4994
4098
  patch(
4995
4099
  null,
4996
4100
  vnode,
@@ -5023,13 +4127,12 @@ Server rendered element contains fewer child nodes than client vdom.`
5023
4127
  if (next && isComment(next) && next.data === "]") {
5024
4128
  return nextSibling(vnode.anchor = next);
5025
4129
  } else {
5026
- hasMismatch = true;
4130
+ logMismatchError();
5027
4131
  insert(vnode.anchor = createComment(`]`), container, next);
5028
4132
  return next;
5029
4133
  }
5030
4134
  };
5031
4135
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5032
- hasMismatch = true;
5033
4136
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5034
4137
  `Hydration node mismatch:
5035
4138
  - rendered on server:`,
@@ -5039,6 +4142,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5039
4142
  - expected on client:`,
5040
4143
  vnode.type
5041
4144
  );
4145
+ logMismatchError();
5042
4146
  vnode.el = null;
5043
4147
  if (isFragment) {
5044
4148
  const end = locateClosingAnchor(node);
@@ -5071,8 +4175,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5071
4175
  while (node) {
5072
4176
  node = nextSibling(node);
5073
4177
  if (node && isComment(node)) {
5074
- if (node.data === open)
5075
- match++;
4178
+ if (node.data === open) match++;
5076
4179
  if (node.data === close) {
5077
4180
  if (match === 0) {
5078
4181
  return nextSibling(node);
@@ -5103,7 +4206,6 @@ Server rendered element contains fewer child nodes than client vdom.`
5103
4206
  return [hydrate, hydrateNode];
5104
4207
  }
5105
4208
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5106
- var _a;
5107
4209
  let mismatchType;
5108
4210
  let mismatchKey;
5109
4211
  let actual;
@@ -5126,12 +4228,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5126
4228
  }
5127
4229
  }
5128
4230
  }
5129
- const root = instance == null ? void 0 : instance.subTree;
5130
- if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
5131
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
5132
- for (const key2 in cssVars) {
5133
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
5134
- }
4231
+ if (instance) {
4232
+ resolveCssVars(instance, vnode, expectedMap);
5135
4233
  }
5136
4234
  if (!isMapEqual(actualMap, expectedMap)) {
5137
4235
  mismatchType = mismatchKey = "style";
@@ -5191,8 +4289,8 @@ function toStyleMap(str) {
5191
4289
  const styleMap = /* @__PURE__ */ new Map();
5192
4290
  for (const item of str.split(";")) {
5193
4291
  let [key, value] = item.split(":");
5194
- key = key == null ? void 0 : key.trim();
5195
- value = value == null ? void 0 : value.trim();
4292
+ key = key.trim();
4293
+ value = value && value.trim();
5196
4294
  if (key && value) {
5197
4295
  styleMap.set(key, value);
5198
4296
  }
@@ -5210,6 +4308,18 @@ function isMapEqual(a, b) {
5210
4308
  }
5211
4309
  return true;
5212
4310
  }
4311
+ function resolveCssVars(instance, vnode, expectedMap) {
4312
+ const root = instance.subTree;
4313
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4314
+ const cssVars = instance.getCssVars();
4315
+ for (const key in cssVars) {
4316
+ expectedMap.set(`--${key}`, String(cssVars[key]));
4317
+ }
4318
+ }
4319
+ if (vnode === root && instance.parent) {
4320
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
4321
+ }
4322
+ }
5213
4323
 
5214
4324
  let supported;
5215
4325
  let perf;
@@ -5554,14 +4664,8 @@ function baseCreateRenderer(options, createHydrationFns) {
5554
4664
  }
5555
4665
  }
5556
4666
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5557
- Object.defineProperty(el, "__vnode", {
5558
- value: vnode,
5559
- enumerable: false
5560
- });
5561
- Object.defineProperty(el, "__vueParentComponent", {
5562
- value: parentComponent,
5563
- enumerable: false
5564
- });
4667
+ def(el, "__vnode", vnode, true);
4668
+ def(el, "__vueParentComponent", parentComponent, true);
5565
4669
  }
5566
4670
  if (dirs) {
5567
4671
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -5623,6 +4727,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5623
4727
  };
5624
4728
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5625
4729
  const el = n2.el = n1.el;
4730
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4731
+ el.__vnode = n2;
4732
+ }
5626
4733
  let { patchFlag, dynamicChildren, dirs } = n2;
5627
4734
  patchFlag |= n1.patchFlag & 16;
5628
4735
  const oldProps = n1.props || EMPTY_OBJ;
@@ -5783,8 +4890,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5783
4890
  }
5784
4891
  }
5785
4892
  for (const key in newProps) {
5786
- if (isReservedProp(key))
5787
- continue;
4893
+ if (isReservedProp(key)) continue;
5788
4894
  const next = newProps[key];
5789
4895
  const prev = oldProps[key];
5790
4896
  if (next !== prev && key !== "value") {
@@ -5932,7 +5038,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5932
5038
  }
5933
5039
  }
5934
5040
  if (instance.asyncDep) {
5935
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
5041
+ parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
5936
5042
  if (!initialVNode.el) {
5937
5043
  const placeholder = instance.subTree = createVNode(Comment);
5938
5044
  processCommentNode(null, placeholder, container, anchor);
@@ -6151,661 +5257,1553 @@ function baseCreateRenderer(options, createHydrationFns) {
6151
5257
  }
6152
5258
  }
6153
5259
  };
6154
- const effect = instance.effect = new ReactiveEffect(
6155
- componentUpdateFn,
6156
- NOOP,
6157
- () => queueJob(update),
6158
- instance.scope
6159
- // track it in component's effect scope
6160
- );
6161
- const update = instance.update = () => {
6162
- if (effect.dirty) {
6163
- effect.run();
5260
+ const effect = instance.effect = new ReactiveEffect(
5261
+ componentUpdateFn,
5262
+ NOOP,
5263
+ () => queueJob(update),
5264
+ instance.scope
5265
+ // track it in component's effect scope
5266
+ );
5267
+ const update = instance.update = () => {
5268
+ if (effect.dirty) {
5269
+ effect.run();
5270
+ }
5271
+ };
5272
+ update.id = instance.uid;
5273
+ toggleRecurse(instance, true);
5274
+ if (!!(process.env.NODE_ENV !== "production")) {
5275
+ effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5276
+ effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5277
+ update.ownerInstance = instance;
5278
+ }
5279
+ update();
5280
+ };
5281
+ const updateComponentPreRender = (instance, nextVNode, optimized) => {
5282
+ nextVNode.component = instance;
5283
+ const prevProps = instance.vnode.props;
5284
+ instance.vnode = nextVNode;
5285
+ instance.next = null;
5286
+ updateProps(instance, nextVNode.props, prevProps, optimized);
5287
+ updateSlots(instance, nextVNode.children, optimized);
5288
+ pauseTracking();
5289
+ flushPreFlushCbs(instance);
5290
+ resetTracking();
5291
+ };
5292
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5293
+ const c1 = n1 && n1.children;
5294
+ const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5295
+ const c2 = n2.children;
5296
+ const { patchFlag, shapeFlag } = n2;
5297
+ if (patchFlag > 0) {
5298
+ if (patchFlag & 128) {
5299
+ patchKeyedChildren(
5300
+ c1,
5301
+ c2,
5302
+ container,
5303
+ anchor,
5304
+ parentComponent,
5305
+ parentSuspense,
5306
+ namespace,
5307
+ slotScopeIds,
5308
+ optimized
5309
+ );
5310
+ return;
5311
+ } else if (patchFlag & 256) {
5312
+ patchUnkeyedChildren(
5313
+ c1,
5314
+ c2,
5315
+ container,
5316
+ anchor,
5317
+ parentComponent,
5318
+ parentSuspense,
5319
+ namespace,
5320
+ slotScopeIds,
5321
+ optimized
5322
+ );
5323
+ return;
5324
+ }
5325
+ }
5326
+ if (shapeFlag & 8) {
5327
+ if (prevShapeFlag & 16) {
5328
+ unmountChildren(c1, parentComponent, parentSuspense);
5329
+ }
5330
+ if (c2 !== c1) {
5331
+ hostSetElementText(container, c2);
5332
+ }
5333
+ } else {
5334
+ if (prevShapeFlag & 16) {
5335
+ if (shapeFlag & 16) {
5336
+ patchKeyedChildren(
5337
+ c1,
5338
+ c2,
5339
+ container,
5340
+ anchor,
5341
+ parentComponent,
5342
+ parentSuspense,
5343
+ namespace,
5344
+ slotScopeIds,
5345
+ optimized
5346
+ );
5347
+ } else {
5348
+ unmountChildren(c1, parentComponent, parentSuspense, true);
5349
+ }
5350
+ } else {
5351
+ if (prevShapeFlag & 8) {
5352
+ hostSetElementText(container, "");
5353
+ }
5354
+ if (shapeFlag & 16) {
5355
+ mountChildren(
5356
+ c2,
5357
+ container,
5358
+ anchor,
5359
+ parentComponent,
5360
+ parentSuspense,
5361
+ namespace,
5362
+ slotScopeIds,
5363
+ optimized
5364
+ );
5365
+ }
5366
+ }
5367
+ }
5368
+ };
5369
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5370
+ c1 = c1 || EMPTY_ARR;
5371
+ c2 = c2 || EMPTY_ARR;
5372
+ const oldLength = c1.length;
5373
+ const newLength = c2.length;
5374
+ const commonLength = Math.min(oldLength, newLength);
5375
+ let i;
5376
+ for (i = 0; i < commonLength; i++) {
5377
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5378
+ patch(
5379
+ c1[i],
5380
+ nextChild,
5381
+ container,
5382
+ null,
5383
+ parentComponent,
5384
+ parentSuspense,
5385
+ namespace,
5386
+ slotScopeIds,
5387
+ optimized
5388
+ );
5389
+ }
5390
+ if (oldLength > newLength) {
5391
+ unmountChildren(
5392
+ c1,
5393
+ parentComponent,
5394
+ parentSuspense,
5395
+ true,
5396
+ false,
5397
+ commonLength
5398
+ );
5399
+ } else {
5400
+ mountChildren(
5401
+ c2,
5402
+ container,
5403
+ anchor,
5404
+ parentComponent,
5405
+ parentSuspense,
5406
+ namespace,
5407
+ slotScopeIds,
5408
+ optimized,
5409
+ commonLength
5410
+ );
5411
+ }
5412
+ };
5413
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5414
+ let i = 0;
5415
+ const l2 = c2.length;
5416
+ let e1 = c1.length - 1;
5417
+ let e2 = l2 - 1;
5418
+ while (i <= e1 && i <= e2) {
5419
+ const n1 = c1[i];
5420
+ const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5421
+ if (isSameVNodeType(n1, n2)) {
5422
+ patch(
5423
+ n1,
5424
+ n2,
5425
+ container,
5426
+ null,
5427
+ parentComponent,
5428
+ parentSuspense,
5429
+ namespace,
5430
+ slotScopeIds,
5431
+ optimized
5432
+ );
5433
+ } else {
5434
+ break;
5435
+ }
5436
+ i++;
5437
+ }
5438
+ while (i <= e1 && i <= e2) {
5439
+ const n1 = c1[e1];
5440
+ const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
5441
+ if (isSameVNodeType(n1, n2)) {
5442
+ patch(
5443
+ n1,
5444
+ n2,
5445
+ container,
5446
+ null,
5447
+ parentComponent,
5448
+ parentSuspense,
5449
+ namespace,
5450
+ slotScopeIds,
5451
+ optimized
5452
+ );
5453
+ } else {
5454
+ break;
5455
+ }
5456
+ e1--;
5457
+ e2--;
5458
+ }
5459
+ if (i > e1) {
5460
+ if (i <= e2) {
5461
+ const nextPos = e2 + 1;
5462
+ const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
5463
+ while (i <= e2) {
5464
+ patch(
5465
+ null,
5466
+ c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
5467
+ container,
5468
+ anchor,
5469
+ parentComponent,
5470
+ parentSuspense,
5471
+ namespace,
5472
+ slotScopeIds,
5473
+ optimized
5474
+ );
5475
+ i++;
5476
+ }
5477
+ }
5478
+ } else if (i > e2) {
5479
+ while (i <= e1) {
5480
+ unmount(c1[i], parentComponent, parentSuspense, true);
5481
+ i++;
5482
+ }
5483
+ } else {
5484
+ const s1 = i;
5485
+ const s2 = i;
5486
+ const keyToNewIndexMap = /* @__PURE__ */ new Map();
5487
+ for (i = s2; i <= e2; i++) {
5488
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5489
+ if (nextChild.key != null) {
5490
+ if (!!(process.env.NODE_ENV !== "production") && keyToNewIndexMap.has(nextChild.key)) {
5491
+ warn$1(
5492
+ `Duplicate keys found during update:`,
5493
+ JSON.stringify(nextChild.key),
5494
+ `Make sure keys are unique.`
5495
+ );
5496
+ }
5497
+ keyToNewIndexMap.set(nextChild.key, i);
5498
+ }
5499
+ }
5500
+ let j;
5501
+ let patched = 0;
5502
+ const toBePatched = e2 - s2 + 1;
5503
+ let moved = false;
5504
+ let maxNewIndexSoFar = 0;
5505
+ const newIndexToOldIndexMap = new Array(toBePatched);
5506
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
5507
+ for (i = s1; i <= e1; i++) {
5508
+ const prevChild = c1[i];
5509
+ if (patched >= toBePatched) {
5510
+ unmount(prevChild, parentComponent, parentSuspense, true);
5511
+ continue;
5512
+ }
5513
+ let newIndex;
5514
+ if (prevChild.key != null) {
5515
+ newIndex = keyToNewIndexMap.get(prevChild.key);
5516
+ } else {
5517
+ for (j = s2; j <= e2; j++) {
5518
+ if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
5519
+ newIndex = j;
5520
+ break;
5521
+ }
5522
+ }
5523
+ }
5524
+ if (newIndex === void 0) {
5525
+ unmount(prevChild, parentComponent, parentSuspense, true);
5526
+ } else {
5527
+ newIndexToOldIndexMap[newIndex - s2] = i + 1;
5528
+ if (newIndex >= maxNewIndexSoFar) {
5529
+ maxNewIndexSoFar = newIndex;
5530
+ } else {
5531
+ moved = true;
5532
+ }
5533
+ patch(
5534
+ prevChild,
5535
+ c2[newIndex],
5536
+ container,
5537
+ null,
5538
+ parentComponent,
5539
+ parentSuspense,
5540
+ namespace,
5541
+ slotScopeIds,
5542
+ optimized
5543
+ );
5544
+ patched++;
5545
+ }
5546
+ }
5547
+ const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
5548
+ j = increasingNewIndexSequence.length - 1;
5549
+ for (i = toBePatched - 1; i >= 0; i--) {
5550
+ const nextIndex = s2 + i;
5551
+ const nextChild = c2[nextIndex];
5552
+ const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
5553
+ if (newIndexToOldIndexMap[i] === 0) {
5554
+ patch(
5555
+ null,
5556
+ nextChild,
5557
+ container,
5558
+ anchor,
5559
+ parentComponent,
5560
+ parentSuspense,
5561
+ namespace,
5562
+ slotScopeIds,
5563
+ optimized
5564
+ );
5565
+ } else if (moved) {
5566
+ if (j < 0 || i !== increasingNewIndexSequence[j]) {
5567
+ move(nextChild, container, anchor, 2);
5568
+ } else {
5569
+ j--;
5570
+ }
5571
+ }
5572
+ }
5573
+ }
5574
+ };
5575
+ const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5576
+ const { el, type, transition, children, shapeFlag } = vnode;
5577
+ if (shapeFlag & 6) {
5578
+ move(vnode.component.subTree, container, anchor, moveType);
5579
+ return;
5580
+ }
5581
+ if (shapeFlag & 128) {
5582
+ vnode.suspense.move(container, anchor, moveType);
5583
+ return;
5584
+ }
5585
+ if (shapeFlag & 64) {
5586
+ type.move(vnode, container, anchor, internals);
5587
+ return;
5588
+ }
5589
+ if (type === Fragment) {
5590
+ hostInsert(el, container, anchor);
5591
+ for (let i = 0; i < children.length; i++) {
5592
+ move(children[i], container, anchor, moveType);
5593
+ }
5594
+ hostInsert(vnode.anchor, container, anchor);
5595
+ return;
5596
+ }
5597
+ if (type === Static) {
5598
+ moveStaticNode(vnode, container, anchor);
5599
+ return;
5600
+ }
5601
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5602
+ if (needTransition2) {
5603
+ if (moveType === 0) {
5604
+ transition.beforeEnter(el);
5605
+ hostInsert(el, container, anchor);
5606
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5607
+ } else {
5608
+ const { leave, delayLeave, afterLeave } = transition;
5609
+ const remove2 = () => hostInsert(el, container, anchor);
5610
+ const performLeave = () => {
5611
+ leave(el, () => {
5612
+ remove2();
5613
+ afterLeave && afterLeave();
5614
+ });
5615
+ };
5616
+ if (delayLeave) {
5617
+ delayLeave(el, remove2, performLeave);
5618
+ } else {
5619
+ performLeave();
5620
+ }
5621
+ }
5622
+ } else {
5623
+ hostInsert(el, container, anchor);
5624
+ }
5625
+ };
5626
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5627
+ const {
5628
+ type,
5629
+ props,
5630
+ ref,
5631
+ children,
5632
+ dynamicChildren,
5633
+ shapeFlag,
5634
+ patchFlag,
5635
+ dirs,
5636
+ memoIndex
5637
+ } = vnode;
5638
+ if (patchFlag === -2) {
5639
+ optimized = false;
5640
+ }
5641
+ if (ref != null) {
5642
+ setRef(ref, null, parentSuspense, vnode, true);
5643
+ }
5644
+ if (memoIndex != null) {
5645
+ parentComponent.renderCache[memoIndex] = void 0;
5646
+ }
5647
+ if (shapeFlag & 256) {
5648
+ parentComponent.ctx.deactivate(vnode);
5649
+ return;
5650
+ }
5651
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
5652
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
5653
+ let vnodeHook;
5654
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
5655
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
5656
+ }
5657
+ if (shapeFlag & 6) {
5658
+ unmountComponent(vnode.component, parentSuspense, doRemove);
5659
+ } else {
5660
+ if (shapeFlag & 128) {
5661
+ vnode.suspense.unmount(parentSuspense, doRemove);
5662
+ return;
5663
+ }
5664
+ if (shouldInvokeDirs) {
5665
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
5666
+ }
5667
+ if (shapeFlag & 64) {
5668
+ vnode.type.remove(
5669
+ vnode,
5670
+ parentComponent,
5671
+ parentSuspense,
5672
+ internals,
5673
+ doRemove
5674
+ );
5675
+ } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
5676
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5677
+ unmountChildren(
5678
+ dynamicChildren,
5679
+ parentComponent,
5680
+ parentSuspense,
5681
+ false,
5682
+ true
5683
+ );
5684
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5685
+ unmountChildren(children, parentComponent, parentSuspense);
5686
+ }
5687
+ if (doRemove) {
5688
+ remove(vnode);
5689
+ }
5690
+ }
5691
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5692
+ queuePostRenderEffect(() => {
5693
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5694
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5695
+ }, parentSuspense);
5696
+ }
5697
+ };
5698
+ const remove = (vnode) => {
5699
+ const { type, el, anchor, transition } = vnode;
5700
+ if (type === Fragment) {
5701
+ if (!!(process.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
5702
+ vnode.children.forEach((child) => {
5703
+ if (child.type === Comment) {
5704
+ hostRemove(child.el);
5705
+ } else {
5706
+ remove(child);
5707
+ }
5708
+ });
5709
+ } else {
5710
+ removeFragment(el, anchor);
5711
+ }
5712
+ return;
5713
+ }
5714
+ if (type === Static) {
5715
+ removeStaticNode(vnode);
5716
+ return;
5717
+ }
5718
+ const performRemove = () => {
5719
+ hostRemove(el);
5720
+ if (transition && !transition.persisted && transition.afterLeave) {
5721
+ transition.afterLeave();
5722
+ }
5723
+ };
5724
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
5725
+ const { leave, delayLeave } = transition;
5726
+ const performLeave = () => leave(el, performRemove);
5727
+ if (delayLeave) {
5728
+ delayLeave(vnode.el, performRemove, performLeave);
5729
+ } else {
5730
+ performLeave();
5731
+ }
5732
+ } else {
5733
+ performRemove();
5734
+ }
5735
+ };
5736
+ const removeFragment = (cur, end) => {
5737
+ let next;
5738
+ while (cur !== end) {
5739
+ next = hostNextSibling(cur);
5740
+ hostRemove(cur);
5741
+ cur = next;
5742
+ }
5743
+ hostRemove(end);
5744
+ };
5745
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
5746
+ if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
5747
+ unregisterHMR(instance);
5748
+ }
5749
+ const { bum, scope, update, subTree, um, m, a } = instance;
5750
+ invalidateMount(m);
5751
+ invalidateMount(a);
5752
+ if (bum) {
5753
+ invokeArrayFns(bum);
5754
+ }
5755
+ scope.stop();
5756
+ if (update) {
5757
+ update.active = false;
5758
+ unmount(subTree, instance, parentSuspense, doRemove);
5759
+ }
5760
+ if (um) {
5761
+ queuePostRenderEffect(um, parentSuspense);
5762
+ }
5763
+ queuePostRenderEffect(() => {
5764
+ instance.isUnmounted = true;
5765
+ }, parentSuspense);
5766
+ if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5767
+ parentSuspense.deps--;
5768
+ if (parentSuspense.deps === 0) {
5769
+ parentSuspense.resolve();
5770
+ }
5771
+ }
5772
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5773
+ devtoolsComponentRemoved(instance);
5774
+ }
5775
+ };
5776
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
5777
+ for (let i = start; i < children.length; i++) {
5778
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
5779
+ }
5780
+ };
5781
+ const getNextHostNode = (vnode) => {
5782
+ if (vnode.shapeFlag & 6) {
5783
+ return getNextHostNode(vnode.component.subTree);
5784
+ }
5785
+ if (vnode.shapeFlag & 128) {
5786
+ return vnode.suspense.next();
5787
+ }
5788
+ return hostNextSibling(vnode.anchor || vnode.el);
5789
+ };
5790
+ let isFlushing = false;
5791
+ const render = (vnode, container, namespace) => {
5792
+ if (vnode == null) {
5793
+ if (container._vnode) {
5794
+ unmount(container._vnode, null, null, true);
5795
+ }
5796
+ } else {
5797
+ patch(
5798
+ container._vnode || null,
5799
+ vnode,
5800
+ container,
5801
+ null,
5802
+ null,
5803
+ null,
5804
+ namespace
5805
+ );
5806
+ }
5807
+ if (!isFlushing) {
5808
+ isFlushing = true;
5809
+ flushPreFlushCbs();
5810
+ flushPostFlushCbs();
5811
+ isFlushing = false;
5812
+ }
5813
+ container._vnode = vnode;
5814
+ };
5815
+ const internals = {
5816
+ p: patch,
5817
+ um: unmount,
5818
+ m: move,
5819
+ r: remove,
5820
+ mt: mountComponent,
5821
+ mc: mountChildren,
5822
+ pc: patchChildren,
5823
+ pbc: patchBlockChildren,
5824
+ n: getNextHostNode,
5825
+ o: options
5826
+ };
5827
+ let hydrate;
5828
+ let hydrateNode;
5829
+ if (createHydrationFns) {
5830
+ [hydrate, hydrateNode] = createHydrationFns(
5831
+ internals
5832
+ );
5833
+ }
5834
+ return {
5835
+ render,
5836
+ hydrate,
5837
+ createApp: createAppAPI(render, hydrate)
5838
+ };
5839
+ }
5840
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
5841
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5842
+ }
5843
+ function toggleRecurse({ effect, update }, allowed) {
5844
+ effect.allowRecurse = update.allowRecurse = allowed;
5845
+ }
5846
+ function needTransition(parentSuspense, transition) {
5847
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
5848
+ }
5849
+ function traverseStaticChildren(n1, n2, shallow = false) {
5850
+ const ch1 = n1.children;
5851
+ const ch2 = n2.children;
5852
+ if (isArray(ch1) && isArray(ch2)) {
5853
+ for (let i = 0; i < ch1.length; i++) {
5854
+ const c1 = ch1[i];
5855
+ let c2 = ch2[i];
5856
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
5857
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
5858
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
5859
+ c2.el = c1.el;
5860
+ }
5861
+ if (!shallow && c2.patchFlag !== -2)
5862
+ traverseStaticChildren(c1, c2);
5863
+ }
5864
+ if (c2.type === Text) {
5865
+ c2.el = c1.el;
5866
+ }
5867
+ if (!!(process.env.NODE_ENV !== "production") && c2.type === Comment && !c2.el) {
5868
+ c2.el = c1.el;
5869
+ }
5870
+ }
5871
+ }
5872
+ }
5873
+ function getSequence(arr) {
5874
+ const p = arr.slice();
5875
+ const result = [0];
5876
+ let i, j, u, v, c;
5877
+ const len = arr.length;
5878
+ for (i = 0; i < len; i++) {
5879
+ const arrI = arr[i];
5880
+ if (arrI !== 0) {
5881
+ j = result[result.length - 1];
5882
+ if (arr[j] < arrI) {
5883
+ p[i] = j;
5884
+ result.push(i);
5885
+ continue;
5886
+ }
5887
+ u = 0;
5888
+ v = result.length - 1;
5889
+ while (u < v) {
5890
+ c = u + v >> 1;
5891
+ if (arr[result[c]] < arrI) {
5892
+ u = c + 1;
5893
+ } else {
5894
+ v = c;
5895
+ }
5896
+ }
5897
+ if (arrI < arr[result[u]]) {
5898
+ if (u > 0) {
5899
+ p[i] = result[u - 1];
5900
+ }
5901
+ result[u] = i;
5902
+ }
5903
+ }
5904
+ }
5905
+ u = result.length;
5906
+ v = result[u - 1];
5907
+ while (u-- > 0) {
5908
+ result[u] = v;
5909
+ v = p[v];
5910
+ }
5911
+ return result;
5912
+ }
5913
+ function locateNonHydratedAsyncRoot(instance) {
5914
+ const subComponent = instance.subTree.component;
5915
+ if (subComponent) {
5916
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
5917
+ return subComponent;
5918
+ } else {
5919
+ return locateNonHydratedAsyncRoot(subComponent);
5920
+ }
5921
+ }
5922
+ }
5923
+ function invalidateMount(hooks) {
5924
+ if (hooks) {
5925
+ for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
5926
+ }
5927
+ }
5928
+
5929
+ const ssrContextKey = Symbol.for("v-scx");
5930
+ const useSSRContext = () => {
5931
+ {
5932
+ const ctx = inject(ssrContextKey);
5933
+ if (!ctx) {
5934
+ !!(process.env.NODE_ENV !== "production") && warn$1(
5935
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
5936
+ );
5937
+ }
5938
+ return ctx;
5939
+ }
5940
+ };
5941
+
5942
+ function watchEffect(effect, options) {
5943
+ return doWatch(effect, null, options);
5944
+ }
5945
+ function watchPostEffect(effect, options) {
5946
+ return doWatch(
5947
+ effect,
5948
+ null,
5949
+ !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "post" }) : { flush: "post" }
5950
+ );
5951
+ }
5952
+ function watchSyncEffect(effect, options) {
5953
+ return doWatch(
5954
+ effect,
5955
+ null,
5956
+ !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
5957
+ );
5958
+ }
5959
+ const INITIAL_WATCHER_VALUE = {};
5960
+ function watch(source, cb, options) {
5961
+ if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
5962
+ warn$1(
5963
+ `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
5964
+ );
5965
+ }
5966
+ return doWatch(source, cb, options);
5967
+ }
5968
+ function doWatch(source, cb, {
5969
+ immediate,
5970
+ deep,
5971
+ flush,
5972
+ once,
5973
+ onTrack,
5974
+ onTrigger
5975
+ } = EMPTY_OBJ) {
5976
+ if (cb && once) {
5977
+ const _cb = cb;
5978
+ cb = (...args) => {
5979
+ _cb(...args);
5980
+ unwatch();
5981
+ };
5982
+ }
5983
+ if (!!(process.env.NODE_ENV !== "production") && deep !== void 0 && typeof deep === "number") {
5984
+ warn$1(
5985
+ `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
5986
+ );
5987
+ }
5988
+ if (!!(process.env.NODE_ENV !== "production") && !cb) {
5989
+ if (immediate !== void 0) {
5990
+ warn$1(
5991
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
5992
+ );
5993
+ }
5994
+ if (deep !== void 0) {
5995
+ warn$1(
5996
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
5997
+ );
5998
+ }
5999
+ if (once !== void 0) {
6000
+ warn$1(
6001
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
6002
+ );
6003
+ }
6004
+ }
6005
+ const warnInvalidSource = (s) => {
6006
+ warn$1(
6007
+ `Invalid watch source: `,
6008
+ s,
6009
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
6010
+ );
6011
+ };
6012
+ const instance = currentInstance;
6013
+ const reactiveGetter = (source2) => deep === true ? source2 : (
6014
+ // for deep: false, only traverse root-level properties
6015
+ traverse(source2, deep === false ? 1 : void 0)
6016
+ );
6017
+ let getter;
6018
+ let forceTrigger = false;
6019
+ let isMultiSource = false;
6020
+ if (isRef(source)) {
6021
+ getter = () => source.value;
6022
+ forceTrigger = isShallow(source);
6023
+ } else if (isReactive(source)) {
6024
+ getter = () => reactiveGetter(source);
6025
+ forceTrigger = true;
6026
+ } else if (isArray(source)) {
6027
+ isMultiSource = true;
6028
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
6029
+ getter = () => source.map((s) => {
6030
+ if (isRef(s)) {
6031
+ return s.value;
6032
+ } else if (isReactive(s)) {
6033
+ return reactiveGetter(s);
6034
+ } else if (isFunction(s)) {
6035
+ return callWithErrorHandling(s, instance, 2);
6036
+ } else {
6037
+ !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
6038
+ }
6039
+ });
6040
+ } else if (isFunction(source)) {
6041
+ if (cb) {
6042
+ getter = () => callWithErrorHandling(source, instance, 2);
6043
+ } else {
6044
+ getter = () => {
6045
+ if (cleanup) {
6046
+ cleanup();
6047
+ }
6048
+ return callWithAsyncErrorHandling(
6049
+ source,
6050
+ instance,
6051
+ 3,
6052
+ [onCleanup]
6053
+ );
6054
+ };
6055
+ }
6056
+ } else {
6057
+ getter = NOOP;
6058
+ !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
6059
+ }
6060
+ if (cb && deep) {
6061
+ const baseGetter = getter;
6062
+ getter = () => traverse(baseGetter());
6063
+ }
6064
+ let cleanup;
6065
+ let onCleanup = (fn) => {
6066
+ cleanup = effect.onStop = () => {
6067
+ callWithErrorHandling(fn, instance, 4);
6068
+ cleanup = effect.onStop = void 0;
6069
+ };
6070
+ };
6071
+ let ssrCleanup;
6072
+ if (isInSSRComponentSetup) {
6073
+ onCleanup = NOOP;
6074
+ if (!cb) {
6075
+ getter();
6076
+ } else if (immediate) {
6077
+ callWithAsyncErrorHandling(cb, instance, 3, [
6078
+ getter(),
6079
+ isMultiSource ? [] : void 0,
6080
+ onCleanup
6081
+ ]);
6082
+ }
6083
+ if (flush === "sync") {
6084
+ const ctx = useSSRContext();
6085
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
6086
+ } else {
6087
+ return NOOP;
6088
+ }
6089
+ }
6090
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
6091
+ const job = () => {
6092
+ if (!effect.active || !effect.dirty) {
6093
+ return;
6094
+ }
6095
+ if (cb) {
6096
+ const newValue = effect.run();
6097
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
6098
+ if (cleanup) {
6099
+ cleanup();
6100
+ }
6101
+ callWithAsyncErrorHandling(cb, instance, 3, [
6102
+ newValue,
6103
+ // pass undefined as the old value when it's changed for the first time
6104
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
6105
+ onCleanup
6106
+ ]);
6107
+ oldValue = newValue;
6164
6108
  }
6165
- };
6166
- update.id = instance.uid;
6167
- toggleRecurse(instance, true);
6168
- if (!!(process.env.NODE_ENV !== "production")) {
6169
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
6170
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
6171
- update.ownerInstance = instance;
6109
+ } else {
6110
+ effect.run();
6172
6111
  }
6173
- update();
6174
- };
6175
- const updateComponentPreRender = (instance, nextVNode, optimized) => {
6176
- nextVNode.component = instance;
6177
- const prevProps = instance.vnode.props;
6178
- instance.vnode = nextVNode;
6179
- instance.next = null;
6180
- updateProps(instance, nextVNode.props, prevProps, optimized);
6181
- updateSlots(instance, nextVNode.children, optimized);
6182
- pauseTracking();
6183
- flushPreFlushCbs(instance);
6184
- resetTracking();
6185
6112
  };
6186
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
6187
- const c1 = n1 && n1.children;
6188
- const prevShapeFlag = n1 ? n1.shapeFlag : 0;
6189
- const c2 = n2.children;
6190
- const { patchFlag, shapeFlag } = n2;
6191
- if (patchFlag > 0) {
6192
- if (patchFlag & 128) {
6193
- patchKeyedChildren(
6194
- c1,
6195
- c2,
6196
- container,
6197
- anchor,
6198
- parentComponent,
6199
- parentSuspense,
6200
- namespace,
6201
- slotScopeIds,
6202
- optimized
6203
- );
6204
- return;
6205
- } else if (patchFlag & 256) {
6206
- patchUnkeyedChildren(
6207
- c1,
6208
- c2,
6209
- container,
6210
- anchor,
6211
- parentComponent,
6212
- parentSuspense,
6213
- namespace,
6214
- slotScopeIds,
6215
- optimized
6216
- );
6217
- return;
6218
- }
6113
+ job.allowRecurse = !!cb;
6114
+ let scheduler;
6115
+ if (flush === "sync") {
6116
+ scheduler = job;
6117
+ } else if (flush === "post") {
6118
+ scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
6119
+ } else {
6120
+ job.pre = true;
6121
+ if (instance) job.id = instance.uid;
6122
+ scheduler = () => queueJob(job);
6123
+ }
6124
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
6125
+ const scope = getCurrentScope();
6126
+ const unwatch = () => {
6127
+ effect.stop();
6128
+ if (scope) {
6129
+ remove(scope.effects, effect);
6219
6130
  }
6220
- if (shapeFlag & 8) {
6221
- if (prevShapeFlag & 16) {
6222
- unmountChildren(c1, parentComponent, parentSuspense);
6223
- }
6224
- if (c2 !== c1) {
6225
- hostSetElementText(container, c2);
6226
- }
6131
+ };
6132
+ if (!!(process.env.NODE_ENV !== "production")) {
6133
+ effect.onTrack = onTrack;
6134
+ effect.onTrigger = onTrigger;
6135
+ }
6136
+ if (cb) {
6137
+ if (immediate) {
6138
+ job();
6227
6139
  } else {
6228
- if (prevShapeFlag & 16) {
6229
- if (shapeFlag & 16) {
6230
- patchKeyedChildren(
6231
- c1,
6232
- c2,
6233
- container,
6234
- anchor,
6235
- parentComponent,
6236
- parentSuspense,
6237
- namespace,
6238
- slotScopeIds,
6239
- optimized
6240
- );
6241
- } else {
6242
- unmountChildren(c1, parentComponent, parentSuspense, true);
6243
- }
6244
- } else {
6245
- if (prevShapeFlag & 8) {
6246
- hostSetElementText(container, "");
6247
- }
6248
- if (shapeFlag & 16) {
6249
- mountChildren(
6250
- c2,
6251
- container,
6252
- anchor,
6253
- parentComponent,
6254
- parentSuspense,
6255
- namespace,
6256
- slotScopeIds,
6257
- optimized
6258
- );
6259
- }
6140
+ oldValue = effect.run();
6141
+ }
6142
+ } else if (flush === "post") {
6143
+ queuePostRenderEffect(
6144
+ effect.run.bind(effect),
6145
+ instance && instance.suspense
6146
+ );
6147
+ } else {
6148
+ effect.run();
6149
+ }
6150
+ if (ssrCleanup) ssrCleanup.push(unwatch);
6151
+ return unwatch;
6152
+ }
6153
+ function instanceWatch(source, value, options) {
6154
+ const publicThis = this.proxy;
6155
+ const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
6156
+ let cb;
6157
+ if (isFunction(value)) {
6158
+ cb = value;
6159
+ } else {
6160
+ cb = value.handler;
6161
+ options = value;
6162
+ }
6163
+ const reset = setCurrentInstance(this);
6164
+ const res = doWatch(getter, cb.bind(publicThis), options);
6165
+ reset();
6166
+ return res;
6167
+ }
6168
+ function createPathGetter(ctx, path) {
6169
+ const segments = path.split(".");
6170
+ return () => {
6171
+ let cur = ctx;
6172
+ for (let i = 0; i < segments.length && cur; i++) {
6173
+ cur = cur[segments[i]];
6174
+ }
6175
+ return cur;
6176
+ };
6177
+ }
6178
+ function traverse(value, depth = Infinity, seen) {
6179
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
6180
+ return value;
6181
+ }
6182
+ seen = seen || /* @__PURE__ */ new Set();
6183
+ if (seen.has(value)) {
6184
+ return value;
6185
+ }
6186
+ seen.add(value);
6187
+ depth--;
6188
+ if (isRef(value)) {
6189
+ traverse(value.value, depth, seen);
6190
+ } else if (isArray(value)) {
6191
+ for (let i = 0; i < value.length; i++) {
6192
+ traverse(value[i], depth, seen);
6193
+ }
6194
+ } else if (isSet(value) || isMap(value)) {
6195
+ value.forEach((v) => {
6196
+ traverse(v, depth, seen);
6197
+ });
6198
+ } else if (isPlainObject(value)) {
6199
+ for (const key in value) {
6200
+ traverse(value[key], depth, seen);
6201
+ }
6202
+ for (const key of Object.getOwnPropertySymbols(value)) {
6203
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
6204
+ traverse(value[key], depth, seen);
6260
6205
  }
6261
6206
  }
6262
- };
6263
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6264
- c1 = c1 || EMPTY_ARR;
6265
- c2 = c2 || EMPTY_ARR;
6266
- const oldLength = c1.length;
6267
- const newLength = c2.length;
6268
- const commonLength = Math.min(oldLength, newLength);
6269
- let i;
6270
- for (i = 0; i < commonLength; i++) {
6271
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6272
- patch(
6273
- c1[i],
6274
- nextChild,
6275
- container,
6276
- null,
6277
- parentComponent,
6278
- parentSuspense,
6279
- namespace,
6280
- slotScopeIds,
6281
- optimized
6282
- );
6207
+ }
6208
+ return value;
6209
+ }
6210
+
6211
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
6212
+ const KeepAliveImpl = {
6213
+ name: `KeepAlive`,
6214
+ // Marker for special handling inside the renderer. We are not using a ===
6215
+ // check directly on KeepAlive in the renderer, because importing it directly
6216
+ // would prevent it from being tree-shaken.
6217
+ __isKeepAlive: true,
6218
+ props: {
6219
+ include: [String, RegExp, Array],
6220
+ exclude: [String, RegExp, Array],
6221
+ max: [String, Number]
6222
+ },
6223
+ setup(props, { slots }) {
6224
+ const instance = getCurrentInstance();
6225
+ const sharedContext = instance.ctx;
6226
+ if (!sharedContext.renderer) {
6227
+ return () => {
6228
+ const children = slots.default && slots.default();
6229
+ return children && children.length === 1 ? children[0] : children;
6230
+ };
6283
6231
  }
6284
- if (oldLength > newLength) {
6285
- unmountChildren(
6286
- c1,
6287
- parentComponent,
6288
- parentSuspense,
6289
- true,
6290
- false,
6291
- commonLength
6292
- );
6293
- } else {
6294
- mountChildren(
6295
- c2,
6232
+ const cache = /* @__PURE__ */ new Map();
6233
+ const keys = /* @__PURE__ */ new Set();
6234
+ let current = null;
6235
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6236
+ instance.__v_cache = cache;
6237
+ }
6238
+ const parentSuspense = instance.suspense;
6239
+ const {
6240
+ renderer: {
6241
+ p: patch,
6242
+ m: move,
6243
+ um: _unmount,
6244
+ o: { createElement }
6245
+ }
6246
+ } = sharedContext;
6247
+ const storageContainer = createElement("div");
6248
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
6249
+ const instance2 = vnode.component;
6250
+ move(vnode, container, anchor, 0, parentSuspense);
6251
+ patch(
6252
+ instance2.vnode,
6253
+ vnode,
6296
6254
  container,
6297
6255
  anchor,
6298
- parentComponent,
6256
+ instance2,
6299
6257
  parentSuspense,
6300
6258
  namespace,
6301
- slotScopeIds,
6302
- optimized,
6303
- commonLength
6259
+ vnode.slotScopeIds,
6260
+ optimized
6304
6261
  );
6305
- }
6306
- };
6307
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6308
- let i = 0;
6309
- const l2 = c2.length;
6310
- let e1 = c1.length - 1;
6311
- let e2 = l2 - 1;
6312
- while (i <= e1 && i <= e2) {
6313
- const n1 = c1[i];
6314
- const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6315
- if (isSameVNodeType(n1, n2)) {
6316
- patch(
6317
- n1,
6318
- n2,
6319
- container,
6320
- null,
6321
- parentComponent,
6322
- parentSuspense,
6323
- namespace,
6324
- slotScopeIds,
6325
- optimized
6326
- );
6327
- } else {
6328
- break;
6262
+ queuePostRenderEffect(() => {
6263
+ instance2.isDeactivated = false;
6264
+ if (instance2.a) {
6265
+ invokeArrayFns(instance2.a);
6266
+ }
6267
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
6268
+ if (vnodeHook) {
6269
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6270
+ }
6271
+ }, parentSuspense);
6272
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6273
+ devtoolsComponentAdded(instance2);
6329
6274
  }
6330
- i++;
6331
- }
6332
- while (i <= e1 && i <= e2) {
6333
- const n1 = c1[e1];
6334
- const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
6335
- if (isSameVNodeType(n1, n2)) {
6336
- patch(
6337
- n1,
6338
- n2,
6339
- container,
6340
- null,
6341
- parentComponent,
6342
- parentSuspense,
6343
- namespace,
6344
- slotScopeIds,
6345
- optimized
6346
- );
6347
- } else {
6348
- break;
6275
+ };
6276
+ sharedContext.deactivate = (vnode) => {
6277
+ const instance2 = vnode.component;
6278
+ invalidateMount(instance2.m);
6279
+ invalidateMount(instance2.a);
6280
+ move(vnode, storageContainer, null, 1, parentSuspense);
6281
+ queuePostRenderEffect(() => {
6282
+ if (instance2.da) {
6283
+ invokeArrayFns(instance2.da);
6284
+ }
6285
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
6286
+ if (vnodeHook) {
6287
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6288
+ }
6289
+ instance2.isDeactivated = true;
6290
+ }, parentSuspense);
6291
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6292
+ devtoolsComponentAdded(instance2);
6349
6293
  }
6350
- e1--;
6351
- e2--;
6294
+ };
6295
+ function unmount(vnode) {
6296
+ resetShapeFlag(vnode);
6297
+ _unmount(vnode, instance, parentSuspense, true);
6352
6298
  }
6353
- if (i > e1) {
6354
- if (i <= e2) {
6355
- const nextPos = e2 + 1;
6356
- const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
6357
- while (i <= e2) {
6358
- patch(
6359
- null,
6360
- c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
6361
- container,
6362
- anchor,
6363
- parentComponent,
6364
- parentSuspense,
6365
- namespace,
6366
- slotScopeIds,
6367
- optimized
6368
- );
6369
- i++;
6299
+ function pruneCache(filter) {
6300
+ cache.forEach((vnode, key) => {
6301
+ const name = getComponentName(vnode.type);
6302
+ if (name && (!filter || !filter(name))) {
6303
+ pruneCacheEntry(key);
6370
6304
  }
6305
+ });
6306
+ }
6307
+ function pruneCacheEntry(key) {
6308
+ const cached = cache.get(key);
6309
+ if (!current || !isSameVNodeType(cached, current)) {
6310
+ unmount(cached);
6311
+ } else if (current) {
6312
+ resetShapeFlag(current);
6371
6313
  }
6372
- } else if (i > e2) {
6373
- while (i <= e1) {
6374
- unmount(c1[i], parentComponent, parentSuspense, true);
6375
- i++;
6376
- }
6377
- } else {
6378
- const s1 = i;
6379
- const s2 = i;
6380
- const keyToNewIndexMap = /* @__PURE__ */ new Map();
6381
- for (i = s2; i <= e2; i++) {
6382
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6383
- if (nextChild.key != null) {
6384
- if (!!(process.env.NODE_ENV !== "production") && keyToNewIndexMap.has(nextChild.key)) {
6385
- warn$1(
6386
- `Duplicate keys found during update:`,
6387
- JSON.stringify(nextChild.key),
6388
- `Make sure keys are unique.`
6389
- );
6390
- }
6391
- keyToNewIndexMap.set(nextChild.key, i);
6314
+ cache.delete(key);
6315
+ keys.delete(key);
6316
+ }
6317
+ watch(
6318
+ () => [props.include, props.exclude],
6319
+ ([include, exclude]) => {
6320
+ include && pruneCache((name) => matches(include, name));
6321
+ exclude && pruneCache((name) => !matches(exclude, name));
6322
+ },
6323
+ // prune post-render after `current` has been updated
6324
+ { flush: "post", deep: true }
6325
+ );
6326
+ let pendingCacheKey = null;
6327
+ const cacheSubtree = () => {
6328
+ if (pendingCacheKey != null) {
6329
+ if (isSuspense(instance.subTree.type)) {
6330
+ queuePostRenderEffect(() => {
6331
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6332
+ }, instance.subTree.suspense);
6333
+ } else {
6334
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6392
6335
  }
6393
6336
  }
6394
- let j;
6395
- let patched = 0;
6396
- const toBePatched = e2 - s2 + 1;
6397
- let moved = false;
6398
- let maxNewIndexSoFar = 0;
6399
- const newIndexToOldIndexMap = new Array(toBePatched);
6400
- for (i = 0; i < toBePatched; i++)
6401
- newIndexToOldIndexMap[i] = 0;
6402
- for (i = s1; i <= e1; i++) {
6403
- const prevChild = c1[i];
6404
- if (patched >= toBePatched) {
6405
- unmount(prevChild, parentComponent, parentSuspense, true);
6406
- continue;
6337
+ };
6338
+ onMounted(cacheSubtree);
6339
+ onUpdated(cacheSubtree);
6340
+ onBeforeUnmount(() => {
6341
+ cache.forEach((cached) => {
6342
+ const { subTree, suspense } = instance;
6343
+ const vnode = getInnerChild(subTree);
6344
+ if (cached.type === vnode.type && cached.key === vnode.key) {
6345
+ resetShapeFlag(vnode);
6346
+ const da = vnode.component.da;
6347
+ da && queuePostRenderEffect(da, suspense);
6348
+ return;
6407
6349
  }
6408
- let newIndex;
6409
- if (prevChild.key != null) {
6410
- newIndex = keyToNewIndexMap.get(prevChild.key);
6411
- } else {
6412
- for (j = s2; j <= e2; j++) {
6413
- if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
6414
- newIndex = j;
6415
- break;
6416
- }
6417
- }
6350
+ unmount(cached);
6351
+ });
6352
+ });
6353
+ return () => {
6354
+ pendingCacheKey = null;
6355
+ if (!slots.default) {
6356
+ return null;
6357
+ }
6358
+ const children = slots.default();
6359
+ const rawVNode = children[0];
6360
+ if (children.length > 1) {
6361
+ if (!!(process.env.NODE_ENV !== "production")) {
6362
+ warn$1(`KeepAlive should contain exactly one component child.`);
6418
6363
  }
6419
- if (newIndex === void 0) {
6420
- unmount(prevChild, parentComponent, parentSuspense, true);
6421
- } else {
6422
- newIndexToOldIndexMap[newIndex - s2] = i + 1;
6423
- if (newIndex >= maxNewIndexSoFar) {
6424
- maxNewIndexSoFar = newIndex;
6425
- } else {
6426
- moved = true;
6427
- }
6428
- patch(
6429
- prevChild,
6430
- c2[newIndex],
6431
- container,
6432
- null,
6433
- parentComponent,
6434
- parentSuspense,
6435
- namespace,
6436
- slotScopeIds,
6437
- optimized
6438
- );
6439
- patched++;
6364
+ current = null;
6365
+ return children;
6366
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
6367
+ current = null;
6368
+ return rawVNode;
6369
+ }
6370
+ let vnode = getInnerChild(rawVNode);
6371
+ const comp = vnode.type;
6372
+ const name = getComponentName(
6373
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
6374
+ );
6375
+ const { include, exclude, max } = props;
6376
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
6377
+ current = vnode;
6378
+ return rawVNode;
6379
+ }
6380
+ const key = vnode.key == null ? comp : vnode.key;
6381
+ const cachedVNode = cache.get(key);
6382
+ if (vnode.el) {
6383
+ vnode = cloneVNode(vnode);
6384
+ if (rawVNode.shapeFlag & 128) {
6385
+ rawVNode.ssContent = vnode;
6440
6386
  }
6441
6387
  }
6442
- const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
6443
- j = increasingNewIndexSequence.length - 1;
6444
- for (i = toBePatched - 1; i >= 0; i--) {
6445
- const nextIndex = s2 + i;
6446
- const nextChild = c2[nextIndex];
6447
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
6448
- if (newIndexToOldIndexMap[i] === 0) {
6449
- patch(
6450
- null,
6451
- nextChild,
6452
- container,
6453
- anchor,
6454
- parentComponent,
6455
- parentSuspense,
6456
- namespace,
6457
- slotScopeIds,
6458
- optimized
6459
- );
6460
- } else if (moved) {
6461
- if (j < 0 || i !== increasingNewIndexSequence[j]) {
6462
- move(nextChild, container, anchor, 2);
6463
- } else {
6464
- j--;
6465
- }
6388
+ pendingCacheKey = key;
6389
+ if (cachedVNode) {
6390
+ vnode.el = cachedVNode.el;
6391
+ vnode.component = cachedVNode.component;
6392
+ if (vnode.transition) {
6393
+ setTransitionHooks(vnode, vnode.transition);
6394
+ }
6395
+ vnode.shapeFlag |= 512;
6396
+ keys.delete(key);
6397
+ keys.add(key);
6398
+ } else {
6399
+ keys.add(key);
6400
+ if (max && keys.size > parseInt(max, 10)) {
6401
+ pruneCacheEntry(keys.values().next().value);
6466
6402
  }
6467
6403
  }
6468
- }
6469
- };
6470
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
6471
- const { el, type, transition, children, shapeFlag } = vnode;
6472
- if (shapeFlag & 6) {
6473
- move(vnode.component.subTree, container, anchor, moveType);
6474
- return;
6475
- }
6476
- if (shapeFlag & 128) {
6477
- vnode.suspense.move(container, anchor, moveType);
6478
- return;
6479
- }
6480
- if (shapeFlag & 64) {
6481
- type.move(vnode, container, anchor, internals);
6482
- return;
6483
- }
6484
- if (type === Fragment) {
6485
- hostInsert(el, container, anchor);
6486
- for (let i = 0; i < children.length; i++) {
6487
- move(children[i], container, anchor, moveType);
6404
+ vnode.shapeFlag |= 256;
6405
+ current = vnode;
6406
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
6407
+ };
6408
+ }
6409
+ };
6410
+ const KeepAlive = KeepAliveImpl;
6411
+ function matches(pattern, name) {
6412
+ if (isArray(pattern)) {
6413
+ return pattern.some((p) => matches(p, name));
6414
+ } else if (isString(pattern)) {
6415
+ return pattern.split(",").includes(name);
6416
+ } else if (isRegExp(pattern)) {
6417
+ return pattern.test(name);
6418
+ }
6419
+ return false;
6420
+ }
6421
+ function onActivated(hook, target) {
6422
+ registerKeepAliveHook(hook, "a", target);
6423
+ }
6424
+ function onDeactivated(hook, target) {
6425
+ registerKeepAliveHook(hook, "da", target);
6426
+ }
6427
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
6428
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
6429
+ let current = target;
6430
+ while (current) {
6431
+ if (current.isDeactivated) {
6432
+ return;
6488
6433
  }
6489
- hostInsert(vnode.anchor, container, anchor);
6490
- return;
6491
- }
6492
- if (type === Static) {
6493
- moveStaticNode(vnode, container, anchor);
6494
- return;
6434
+ current = current.parent;
6495
6435
  }
6496
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
6497
- if (needTransition2) {
6498
- if (moveType === 0) {
6499
- transition.beforeEnter(el);
6500
- hostInsert(el, container, anchor);
6501
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
6502
- } else {
6503
- const { leave, delayLeave, afterLeave } = transition;
6504
- const remove2 = () => hostInsert(el, container, anchor);
6505
- const performLeave = () => {
6506
- leave(el, () => {
6507
- remove2();
6508
- afterLeave && afterLeave();
6509
- });
6510
- };
6511
- if (delayLeave) {
6512
- delayLeave(el, remove2, performLeave);
6513
- } else {
6514
- performLeave();
6515
- }
6436
+ return hook();
6437
+ });
6438
+ injectHook(type, wrappedHook, target);
6439
+ if (target) {
6440
+ let current = target.parent;
6441
+ while (current && current.parent) {
6442
+ if (isKeepAlive(current.parent.vnode)) {
6443
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
6516
6444
  }
6517
- } else {
6518
- hostInsert(el, container, anchor);
6445
+ current = current.parent;
6519
6446
  }
6447
+ }
6448
+ }
6449
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
6450
+ const injected = injectHook(
6451
+ type,
6452
+ hook,
6453
+ keepAliveRoot,
6454
+ true
6455
+ /* prepend */
6456
+ );
6457
+ onUnmounted(() => {
6458
+ remove(keepAliveRoot[type], injected);
6459
+ }, target);
6460
+ }
6461
+ function resetShapeFlag(vnode) {
6462
+ vnode.shapeFlag &= ~256;
6463
+ vnode.shapeFlag &= ~512;
6464
+ }
6465
+ function getInnerChild(vnode) {
6466
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
6467
+ }
6468
+
6469
+ const leaveCbKey = Symbol("_leaveCb");
6470
+ const enterCbKey = Symbol("_enterCb");
6471
+ function useTransitionState() {
6472
+ const state = {
6473
+ isMounted: false,
6474
+ isLeaving: false,
6475
+ isUnmounting: false,
6476
+ leavingVNodes: /* @__PURE__ */ new Map()
6520
6477
  };
6521
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6522
- const {
6523
- type,
6524
- props,
6525
- ref,
6526
- children,
6527
- dynamicChildren,
6528
- shapeFlag,
6529
- patchFlag,
6530
- dirs
6531
- } = vnode;
6532
- if (ref != null) {
6533
- setRef(ref, null, parentSuspense, vnode, true);
6534
- }
6535
- if (shapeFlag & 256) {
6536
- parentComponent.ctx.deactivate(vnode);
6537
- return;
6538
- }
6539
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
6540
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
6541
- let vnodeHook;
6542
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
6543
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
6544
- }
6545
- if (shapeFlag & 6) {
6546
- unmountComponent(vnode.component, parentSuspense, doRemove);
6547
- } else {
6548
- if (shapeFlag & 128) {
6549
- vnode.suspense.unmount(parentSuspense, doRemove);
6478
+ onMounted(() => {
6479
+ state.isMounted = true;
6480
+ });
6481
+ onBeforeUnmount(() => {
6482
+ state.isUnmounting = true;
6483
+ });
6484
+ return state;
6485
+ }
6486
+ const TransitionHookValidator = [Function, Array];
6487
+ const BaseTransitionPropsValidators = {
6488
+ mode: String,
6489
+ appear: Boolean,
6490
+ persisted: Boolean,
6491
+ // enter
6492
+ onBeforeEnter: TransitionHookValidator,
6493
+ onEnter: TransitionHookValidator,
6494
+ onAfterEnter: TransitionHookValidator,
6495
+ onEnterCancelled: TransitionHookValidator,
6496
+ // leave
6497
+ onBeforeLeave: TransitionHookValidator,
6498
+ onLeave: TransitionHookValidator,
6499
+ onAfterLeave: TransitionHookValidator,
6500
+ onLeaveCancelled: TransitionHookValidator,
6501
+ // appear
6502
+ onBeforeAppear: TransitionHookValidator,
6503
+ onAppear: TransitionHookValidator,
6504
+ onAfterAppear: TransitionHookValidator,
6505
+ onAppearCancelled: TransitionHookValidator
6506
+ };
6507
+ const recursiveGetSubtree = (instance) => {
6508
+ const subTree = instance.subTree;
6509
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
6510
+ };
6511
+ const BaseTransitionImpl = {
6512
+ name: `BaseTransition`,
6513
+ props: BaseTransitionPropsValidators,
6514
+ setup(props, { slots }) {
6515
+ const instance = getCurrentInstance();
6516
+ const state = useTransitionState();
6517
+ return () => {
6518
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
6519
+ if (!children || !children.length) {
6550
6520
  return;
6551
6521
  }
6552
- if (shouldInvokeDirs) {
6553
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6554
- }
6555
- if (shapeFlag & 64) {
6556
- vnode.type.remove(
6557
- vnode,
6558
- parentComponent,
6559
- parentSuspense,
6560
- optimized,
6561
- internals,
6562
- doRemove
6563
- );
6564
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
6565
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
6566
- unmountChildren(
6567
- dynamicChildren,
6568
- parentComponent,
6569
- parentSuspense,
6570
- false,
6571
- true
6572
- );
6573
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
6574
- unmountChildren(children, parentComponent, parentSuspense);
6575
- }
6576
- if (doRemove) {
6577
- remove(vnode);
6578
- }
6579
- }
6580
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
6581
- queuePostRenderEffect(() => {
6582
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6583
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6584
- }, parentSuspense);
6585
- }
6586
- };
6587
- const remove = (vnode) => {
6588
- const { type, el, anchor, transition } = vnode;
6589
- if (type === Fragment) {
6590
- if (!!(process.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
6591
- vnode.children.forEach((child) => {
6592
- if (child.type === Comment) {
6593
- hostRemove(child.el);
6594
- } else {
6595
- remove(child);
6522
+ let child = children[0];
6523
+ if (children.length > 1) {
6524
+ let hasFound = false;
6525
+ for (const c of children) {
6526
+ if (c.type !== Comment) {
6527
+ if (!!(process.env.NODE_ENV !== "production") && hasFound) {
6528
+ warn$1(
6529
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
6530
+ );
6531
+ break;
6532
+ }
6533
+ child = c;
6534
+ hasFound = true;
6535
+ if (!!!(process.env.NODE_ENV !== "production")) break;
6596
6536
  }
6597
- });
6598
- } else {
6599
- removeFragment(el, anchor);
6600
- }
6601
- return;
6602
- }
6603
- if (type === Static) {
6604
- removeStaticNode(vnode);
6605
- return;
6606
- }
6607
- const performRemove = () => {
6608
- hostRemove(el);
6609
- if (transition && !transition.persisted && transition.afterLeave) {
6610
- transition.afterLeave();
6537
+ }
6611
6538
  }
6612
- };
6613
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6614
- const { leave, delayLeave } = transition;
6615
- const performLeave = () => leave(el, performRemove);
6616
- if (delayLeave) {
6617
- delayLeave(vnode.el, performRemove, performLeave);
6618
- } else {
6619
- performLeave();
6539
+ const rawProps = toRaw(props);
6540
+ const { mode } = rawProps;
6541
+ if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
6542
+ warn$1(`invalid <transition> mode: ${mode}`);
6620
6543
  }
6621
- } else {
6622
- performRemove();
6623
- }
6624
- };
6625
- const removeFragment = (cur, end) => {
6626
- let next;
6627
- while (cur !== end) {
6628
- next = hostNextSibling(cur);
6629
- hostRemove(cur);
6630
- cur = next;
6631
- }
6632
- hostRemove(end);
6633
- };
6634
- const unmountComponent = (instance, parentSuspense, doRemove) => {
6635
- if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
6636
- unregisterHMR(instance);
6637
- }
6638
- const { bum, scope, update, subTree, um } = instance;
6639
- if (bum) {
6640
- invokeArrayFns(bum);
6641
- }
6642
- scope.stop();
6643
- if (update) {
6644
- update.active = false;
6645
- unmount(subTree, instance, parentSuspense, doRemove);
6646
- }
6647
- if (um) {
6648
- queuePostRenderEffect(um, parentSuspense);
6649
- }
6650
- queuePostRenderEffect(() => {
6651
- instance.isUnmounted = true;
6652
- }, parentSuspense);
6653
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
6654
- parentSuspense.deps--;
6655
- if (parentSuspense.deps === 0) {
6656
- parentSuspense.resolve();
6544
+ if (state.isLeaving) {
6545
+ return emptyPlaceholder(child);
6657
6546
  }
6658
- }
6659
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6660
- devtoolsComponentRemoved(instance);
6661
- }
6662
- };
6663
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
6664
- for (let i = start; i < children.length; i++) {
6665
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
6666
- }
6667
- };
6668
- const getNextHostNode = (vnode) => {
6669
- if (vnode.shapeFlag & 6) {
6670
- return getNextHostNode(vnode.component.subTree);
6671
- }
6672
- if (vnode.shapeFlag & 128) {
6673
- return vnode.suspense.next();
6674
- }
6675
- return hostNextSibling(vnode.anchor || vnode.el);
6676
- };
6677
- let isFlushing = false;
6678
- const render = (vnode, container, namespace) => {
6679
- if (vnode == null) {
6680
- if (container._vnode) {
6681
- unmount(container._vnode, null, null, true);
6547
+ const innerChild = getKeepAliveChild(child);
6548
+ if (!innerChild) {
6549
+ return emptyPlaceholder(child);
6682
6550
  }
6683
- } else {
6684
- patch(
6685
- container._vnode || null,
6686
- vnode,
6687
- container,
6688
- null,
6689
- null,
6690
- null,
6691
- namespace
6551
+ let enterHooks = resolveTransitionHooks(
6552
+ innerChild,
6553
+ rawProps,
6554
+ state,
6555
+ instance,
6556
+ // #11061, ensure enterHooks is fresh after clone
6557
+ (hooks) => enterHooks = hooks
6692
6558
  );
6693
- }
6694
- if (!isFlushing) {
6695
- isFlushing = true;
6696
- flushPreFlushCbs();
6697
- flushPostFlushCbs();
6698
- isFlushing = false;
6699
- }
6700
- container._vnode = vnode;
6701
- };
6702
- const internals = {
6703
- p: patch,
6704
- um: unmount,
6705
- m: move,
6706
- r: remove,
6707
- mt: mountComponent,
6708
- mc: mountChildren,
6709
- pc: patchChildren,
6710
- pbc: patchBlockChildren,
6711
- n: getNextHostNode,
6712
- o: options
6713
- };
6714
- let hydrate;
6715
- let hydrateNode;
6716
- if (createHydrationFns) {
6717
- [hydrate, hydrateNode] = createHydrationFns(
6718
- internals
6719
- );
6559
+ setTransitionHooks(innerChild, enterHooks);
6560
+ const oldChild = instance.subTree;
6561
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
6562
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
6563
+ const leavingHooks = resolveTransitionHooks(
6564
+ oldInnerChild,
6565
+ rawProps,
6566
+ state,
6567
+ instance
6568
+ );
6569
+ setTransitionHooks(oldInnerChild, leavingHooks);
6570
+ if (mode === "out-in" && innerChild.type !== Comment) {
6571
+ state.isLeaving = true;
6572
+ leavingHooks.afterLeave = () => {
6573
+ state.isLeaving = false;
6574
+ if (instance.update.active !== false) {
6575
+ instance.effect.dirty = true;
6576
+ instance.update();
6577
+ }
6578
+ };
6579
+ return emptyPlaceholder(child);
6580
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
6581
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
6582
+ const leavingVNodesCache = getLeavingNodesForType(
6583
+ state,
6584
+ oldInnerChild
6585
+ );
6586
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
6587
+ el[leaveCbKey] = () => {
6588
+ earlyRemove();
6589
+ el[leaveCbKey] = void 0;
6590
+ delete enterHooks.delayedLeave;
6591
+ };
6592
+ enterHooks.delayedLeave = delayedLeave;
6593
+ };
6594
+ }
6595
+ }
6596
+ return child;
6597
+ };
6720
6598
  }
6721
- return {
6722
- render,
6723
- hydrate,
6724
- createApp: createAppAPI(render, hydrate)
6725
- };
6726
- }
6727
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
6728
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6729
- }
6730
- function toggleRecurse({ effect, update }, allowed) {
6731
- effect.allowRecurse = update.allowRecurse = allowed;
6732
- }
6733
- function needTransition(parentSuspense, transition) {
6734
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6599
+ };
6600
+ const BaseTransition = BaseTransitionImpl;
6601
+ function getLeavingNodesForType(state, vnode) {
6602
+ const { leavingVNodes } = state;
6603
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
6604
+ if (!leavingVNodesCache) {
6605
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
6606
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
6607
+ }
6608
+ return leavingVNodesCache;
6735
6609
  }
6736
- function traverseStaticChildren(n1, n2, shallow = false) {
6737
- const ch1 = n1.children;
6738
- const ch2 = n2.children;
6739
- if (isArray(ch1) && isArray(ch2)) {
6740
- for (let i = 0; i < ch1.length; i++) {
6741
- const c1 = ch1[i];
6742
- let c2 = ch2[i];
6743
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
6744
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
6745
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
6746
- c2.el = c1.el;
6610
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
6611
+ const {
6612
+ appear,
6613
+ mode,
6614
+ persisted = false,
6615
+ onBeforeEnter,
6616
+ onEnter,
6617
+ onAfterEnter,
6618
+ onEnterCancelled,
6619
+ onBeforeLeave,
6620
+ onLeave,
6621
+ onAfterLeave,
6622
+ onLeaveCancelled,
6623
+ onBeforeAppear,
6624
+ onAppear,
6625
+ onAfterAppear,
6626
+ onAppearCancelled
6627
+ } = props;
6628
+ const key = String(vnode.key);
6629
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
6630
+ const callHook = (hook, args) => {
6631
+ hook && callWithAsyncErrorHandling(
6632
+ hook,
6633
+ instance,
6634
+ 9,
6635
+ args
6636
+ );
6637
+ };
6638
+ const callAsyncHook = (hook, args) => {
6639
+ const done = args[1];
6640
+ callHook(hook, args);
6641
+ if (isArray(hook)) {
6642
+ if (hook.every((hook2) => hook2.length <= 1)) done();
6643
+ } else if (hook.length <= 1) {
6644
+ done();
6645
+ }
6646
+ };
6647
+ const hooks = {
6648
+ mode,
6649
+ persisted,
6650
+ beforeEnter(el) {
6651
+ let hook = onBeforeEnter;
6652
+ if (!state.isMounted) {
6653
+ if (appear) {
6654
+ hook = onBeforeAppear || onBeforeEnter;
6655
+ } else {
6656
+ return;
6747
6657
  }
6748
- if (!shallow)
6749
- traverseStaticChildren(c1, c2);
6750
6658
  }
6751
- if (c2.type === Text) {
6752
- c2.el = c1.el;
6659
+ if (el[leaveCbKey]) {
6660
+ el[leaveCbKey](
6661
+ true
6662
+ /* cancelled */
6663
+ );
6753
6664
  }
6754
- if (!!(process.env.NODE_ENV !== "production") && c2.type === Comment && !c2.el) {
6755
- c2.el = c1.el;
6665
+ const leavingVNode = leavingVNodesCache[key];
6666
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
6667
+ leavingVNode.el[leaveCbKey]();
6756
6668
  }
6757
- }
6758
- }
6759
- }
6760
- function getSequence(arr) {
6761
- const p = arr.slice();
6762
- const result = [0];
6763
- let i, j, u, v, c;
6764
- const len = arr.length;
6765
- for (i = 0; i < len; i++) {
6766
- const arrI = arr[i];
6767
- if (arrI !== 0) {
6768
- j = result[result.length - 1];
6769
- if (arr[j] < arrI) {
6770
- p[i] = j;
6771
- result.push(i);
6772
- continue;
6669
+ callHook(hook, [el]);
6670
+ },
6671
+ enter(el) {
6672
+ let hook = onEnter;
6673
+ let afterHook = onAfterEnter;
6674
+ let cancelHook = onEnterCancelled;
6675
+ if (!state.isMounted) {
6676
+ if (appear) {
6677
+ hook = onAppear || onEnter;
6678
+ afterHook = onAfterAppear || onAfterEnter;
6679
+ cancelHook = onAppearCancelled || onEnterCancelled;
6680
+ } else {
6681
+ return;
6682
+ }
6773
6683
  }
6774
- u = 0;
6775
- v = result.length - 1;
6776
- while (u < v) {
6777
- c = u + v >> 1;
6778
- if (arr[result[c]] < arrI) {
6779
- u = c + 1;
6684
+ let called = false;
6685
+ const done = el[enterCbKey] = (cancelled) => {
6686
+ if (called) return;
6687
+ called = true;
6688
+ if (cancelled) {
6689
+ callHook(cancelHook, [el]);
6780
6690
  } else {
6781
- v = c;
6691
+ callHook(afterHook, [el]);
6692
+ }
6693
+ if (hooks.delayedLeave) {
6694
+ hooks.delayedLeave();
6782
6695
  }
6696
+ el[enterCbKey] = void 0;
6697
+ };
6698
+ if (hook) {
6699
+ callAsyncHook(hook, [el, done]);
6700
+ } else {
6701
+ done();
6783
6702
  }
6784
- if (arrI < arr[result[u]]) {
6785
- if (u > 0) {
6786
- p[i] = result[u - 1];
6703
+ },
6704
+ leave(el, remove) {
6705
+ const key2 = String(vnode.key);
6706
+ if (el[enterCbKey]) {
6707
+ el[enterCbKey](
6708
+ true
6709
+ /* cancelled */
6710
+ );
6711
+ }
6712
+ if (state.isUnmounting) {
6713
+ return remove();
6714
+ }
6715
+ callHook(onBeforeLeave, [el]);
6716
+ let called = false;
6717
+ const done = el[leaveCbKey] = (cancelled) => {
6718
+ if (called) return;
6719
+ called = true;
6720
+ remove();
6721
+ if (cancelled) {
6722
+ callHook(onLeaveCancelled, [el]);
6723
+ } else {
6724
+ callHook(onAfterLeave, [el]);
6787
6725
  }
6788
- result[u] = i;
6726
+ el[leaveCbKey] = void 0;
6727
+ if (leavingVNodesCache[key2] === vnode) {
6728
+ delete leavingVNodesCache[key2];
6729
+ }
6730
+ };
6731
+ leavingVNodesCache[key2] = vnode;
6732
+ if (onLeave) {
6733
+ callAsyncHook(onLeave, [el, done]);
6734
+ } else {
6735
+ done();
6789
6736
  }
6737
+ },
6738
+ clone(vnode2) {
6739
+ const hooks2 = resolveTransitionHooks(
6740
+ vnode2,
6741
+ props,
6742
+ state,
6743
+ instance,
6744
+ postClone
6745
+ );
6746
+ if (postClone) postClone(hooks2);
6747
+ return hooks2;
6748
+ }
6749
+ };
6750
+ return hooks;
6751
+ }
6752
+ function emptyPlaceholder(vnode) {
6753
+ if (isKeepAlive(vnode)) {
6754
+ vnode = cloneVNode(vnode);
6755
+ vnode.children = null;
6756
+ return vnode;
6757
+ }
6758
+ }
6759
+ function getKeepAliveChild(vnode) {
6760
+ if (!isKeepAlive(vnode)) {
6761
+ return vnode;
6762
+ }
6763
+ if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
6764
+ return vnode.component.subTree;
6765
+ }
6766
+ const { shapeFlag, children } = vnode;
6767
+ if (children) {
6768
+ if (shapeFlag & 16) {
6769
+ return children[0];
6770
+ }
6771
+ if (shapeFlag & 32 && isFunction(children.default)) {
6772
+ return children.default();
6790
6773
  }
6791
6774
  }
6792
- u = result.length;
6793
- v = result[u - 1];
6794
- while (u-- > 0) {
6795
- result[u] = v;
6796
- v = p[v];
6775
+ }
6776
+ function setTransitionHooks(vnode, hooks) {
6777
+ if (vnode.shapeFlag & 6 && vnode.component) {
6778
+ setTransitionHooks(vnode.component.subTree, hooks);
6779
+ } else if (vnode.shapeFlag & 128) {
6780
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
6781
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
6782
+ } else {
6783
+ vnode.transition = hooks;
6797
6784
  }
6798
- return result;
6799
6785
  }
6800
- function locateNonHydratedAsyncRoot(instance) {
6801
- const subComponent = instance.subTree.component;
6802
- if (subComponent) {
6803
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
6804
- return subComponent;
6805
- } else {
6806
- return locateNonHydratedAsyncRoot(subComponent);
6786
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
6787
+ let ret = [];
6788
+ let keyedFragmentCount = 0;
6789
+ for (let i = 0; i < children.length; i++) {
6790
+ let child = children[i];
6791
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
6792
+ if (child.type === Fragment) {
6793
+ if (child.patchFlag & 128) keyedFragmentCount++;
6794
+ ret = ret.concat(
6795
+ getTransitionRawChildren(child.children, keepComment, key)
6796
+ );
6797
+ } else if (keepComment || child.type !== Comment) {
6798
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
6799
+ }
6800
+ }
6801
+ if (keyedFragmentCount > 1) {
6802
+ for (let i = 0; i < ret.length; i++) {
6803
+ ret[i].patchFlag = -2;
6807
6804
  }
6808
6805
  }
6806
+ return ret;
6809
6807
  }
6810
6808
 
6811
6809
  const isTeleport = (type) => type.__isTeleport;
@@ -6822,8 +6820,8 @@ const resolveTarget = (props, select) => {
6822
6820
  return null;
6823
6821
  } else {
6824
6822
  const target = select(targetSelector);
6825
- if (!target) {
6826
- !!(process.env.NODE_ENV !== "production") && warn$1(
6823
+ if (!!(process.env.NODE_ENV !== "production") && !target && !isTeleportDisabled(props)) {
6824
+ warn$1(
6827
6825
  `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
6828
6826
  );
6829
6827
  }
@@ -6973,7 +6971,7 @@ const TeleportImpl = {
6973
6971
  }
6974
6972
  updateCssVars(n2);
6975
6973
  },
6976
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6974
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6977
6975
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
6978
6976
  if (target) {
6979
6977
  hostRemove(targetAnchor);
@@ -7074,8 +7072,7 @@ function updateCssVars(vnode) {
7074
7072
  if (ctx && ctx.ut) {
7075
7073
  let node = vnode.children[0].el;
7076
7074
  while (node && node !== vnode.targetAnchor) {
7077
- if (node.nodeType === 1)
7078
- node.setAttribute("data-v-owner", ctx.uid);
7075
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
7079
7076
  node = node.nextSibling;
7080
7077
  }
7081
7078
  ctx.ut();
@@ -7241,7 +7238,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
7241
7238
  currentBlock.push(cloned);
7242
7239
  }
7243
7240
  }
7244
- cloned.patchFlag |= -2;
7241
+ cloned.patchFlag = -2;
7245
7242
  return cloned;
7246
7243
  }
7247
7244
  if (isClassComponent(type)) {
@@ -7282,8 +7279,7 @@ Component that was made reactive: `,
7282
7279
  );
7283
7280
  }
7284
7281
  function guardReactiveProps(props) {
7285
- if (!props)
7286
- return null;
7282
+ if (!props) return null;
7287
7283
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
7288
7284
  }
7289
7285
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
@@ -7332,7 +7328,10 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7332
7328
  ce: vnode.ce
7333
7329
  };
7334
7330
  if (transition && cloneTransition) {
7335
- cloned.transition = transition.clone(cloned);
7331
+ setTransitionHooks(
7332
+ cloned,
7333
+ transition.clone(cloned)
7334
+ );
7336
7335
  }
7337
7336
  return cloned;
7338
7337
  }
@@ -7550,14 +7549,11 @@ let setInSSRSetupState;
7550
7549
  const g = getGlobalThis();
7551
7550
  const registerGlobalSetter = (key, setter) => {
7552
7551
  let setters;
7553
- if (!(setters = g[key]))
7554
- setters = g[key] = [];
7552
+ if (!(setters = g[key])) setters = g[key] = [];
7555
7553
  setters.push(setter);
7556
7554
  return (v) => {
7557
- if (setters.length > 1)
7558
- setters.forEach((set) => set(v));
7559
- else
7560
- setters[0](v);
7555
+ if (setters.length > 1) setters.forEach((set) => set(v));
7556
+ else setters[0](v);
7561
7557
  };
7562
7558
  };
7563
7559
  internalSetCurrentInstance = registerGlobalSetter(
@@ -7839,7 +7835,7 @@ function createSetupContext(instance) {
7839
7835
  };
7840
7836
  }
7841
7837
  }
7842
- function getExposeProxy(instance) {
7838
+ function getComponentPublicInstance(instance) {
7843
7839
  if (instance.exposed) {
7844
7840
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
7845
7841
  get(target, key) {
@@ -7853,6 +7849,8 @@ function getExposeProxy(instance) {
7853
7849
  return key in target || key in publicPropertiesMap;
7854
7850
  }
7855
7851
  }));
7852
+ } else {
7853
+ return instance.proxy;
7856
7854
  }
7857
7855
  }
7858
7856
  const classifyRE = /(?:^|[-_])(\w)/g;
@@ -8154,6 +8152,7 @@ function withMemo(memo, render, cache, index) {
8154
8152
  }
8155
8153
  const ret = render();
8156
8154
  ret.memo = memo.slice();
8155
+ ret.memoIndex = index;
8157
8156
  return cache[index] = ret;
8158
8157
  }
8159
8158
  function isMemoSame(cached, memo) {
@@ -8172,7 +8171,7 @@ function isMemoSame(cached, memo) {
8172
8171
  return true;
8173
8172
  }
8174
8173
 
8175
- const version = "3.4.27";
8174
+ const version = "3.4.31";
8176
8175
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8177
8176
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8178
8177
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -8183,7 +8182,8 @@ const _ssrUtils = {
8183
8182
  renderComponentRoot,
8184
8183
  setCurrentRenderingInstance,
8185
8184
  isVNode: isVNode,
8186
- normalizeVNode
8185
+ normalizeVNode,
8186
+ getComponentPublicInstance
8187
8187
  };
8188
8188
  const ssrUtils = _ssrUtils ;
8189
8189
  const resolveFilter = null;