@vue/runtime-core 3.4.27 → 3.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.4.27
2
+ * @vue/runtime-core v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -28,6 +28,7 @@ function warn$1(msg, ...args) {
28
28
  instance,
29
29
  11,
30
30
  [
31
+ // eslint-disable-next-line no-restricted-syntax
31
32
  msg + args.map((a) => {
32
33
  var _a, _b;
33
34
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
@@ -370,10 +371,11 @@ function flushPostFlushCbs(seen) {
370
371
  seen = seen || /* @__PURE__ */ new Map();
371
372
  }
372
373
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
373
- if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
374
+ const cb = activePostFlushCbs[postFlushIndex];
375
+ if (checkRecursiveUpdates(seen, cb)) {
374
376
  continue;
375
377
  }
376
- activePostFlushCbs[postFlushIndex]();
378
+ if (cb.active !== false) cb();
377
379
  }
378
380
  activePostFlushCbs = null;
379
381
  postFlushIndex = 0;
@@ -383,10 +385,8 @@ const getId = (job) => job.id == null ? Infinity : job.id;
383
385
  const comparator = (a, b) => {
384
386
  const diff = getId(a) - getId(b);
385
387
  if (diff === 0) {
386
- if (a.pre && !b.pre)
387
- return -1;
388
- if (b.pre && !a.pre)
389
- return 1;
388
+ if (a.pre && !b.pre) return -1;
389
+ if (b.pre && !a.pre) return 1;
390
390
  }
391
391
  return diff;
392
392
  };
@@ -494,8 +494,7 @@ function rerender(id, newRender) {
494
494
  }
495
495
  function reload(id, newComp) {
496
496
  const record = map.get(id);
497
- if (!record)
498
- return;
497
+ if (!record) return;
499
498
  newComp = normalizeClassComponent(newComp);
500
499
  updateComponentDef(record.initialDef, newComp);
501
500
  const instances = [...record.instances];
@@ -516,7 +515,10 @@ function reload(id, newComp) {
516
515
  hmrDirtyComponents.delete(oldComp);
517
516
  } else if (instance.parent) {
518
517
  instance.parent.effect.dirty = true;
519
- queueJob(instance.parent.update);
518
+ queueJob(() => {
519
+ instance.parent.update();
520
+ hmrDirtyComponents.delete(oldComp);
521
+ });
520
522
  } else if (instance.appContext.reload) {
521
523
  instance.appContext.reload();
522
524
  } else if (typeof window !== "undefined") {
@@ -579,6 +581,7 @@ function setDevtoolsHook$1(hook, target) {
579
581
  // (#4815)
580
582
  typeof window !== "undefined" && // some envs mock window but not fully
581
583
  window.HTMLElement && // also exclude jsdom
584
+ // eslint-disable-next-line no-restricted-syntax
582
585
  !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
583
586
  ) {
584
587
  const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
@@ -656,8 +659,7 @@ function devtoolsComponentEmit(component, event, params) {
656
659
  }
657
660
 
658
661
  function emit(instance, event, ...rawArgs) {
659
- if (instance.isUnmounted)
660
- return;
662
+ if (instance.isUnmounted) return;
661
663
  const props = instance.vnode.props || shared.EMPTY_OBJ;
662
664
  {
663
665
  const {
@@ -810,8 +812,7 @@ function popScopeId() {
810
812
  }
811
813
  const withScopeId = (_id) => withCtx;
812
814
  function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
813
- if (!ctx)
814
- return fn;
815
+ if (!ctx) return fn;
815
816
  if (fn._n) {
816
817
  return fn;
817
818
  }
@@ -1614,7 +1615,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1614
1615
  next() {
1615
1616
  return suspense.activeBranch && next(suspense.activeBranch);
1616
1617
  },
1617
- registerDep(instance, setupRenderEffect) {
1618
+ registerDep(instance, setupRenderEffect, optimized2) {
1618
1619
  const isInPendingSuspense = !!suspense.pendingBranch;
1619
1620
  if (isInPendingSuspense) {
1620
1621
  suspense.deps++;
@@ -1648,7 +1649,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1648
1649
  hydratedEl ? null : next(instance.subTree),
1649
1650
  suspense,
1650
1651
  namespace,
1651
- optimized
1652
+ optimized2
1652
1653
  );
1653
1654
  if (placeholder) {
1654
1655
  remove(placeholder);
@@ -1778,793 +1779,288 @@ function isVNodeSuspensible(vnode) {
1778
1779
  return suspensible != null && suspensible !== false;
1779
1780
  }
1780
1781
 
1781
- const ssrContextKey = Symbol.for("v-scx");
1782
- const useSSRContext = () => {
1783
- {
1784
- const ctx = inject(ssrContextKey);
1785
- if (!ctx) {
1786
- warn$1(
1787
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
1788
- );
1782
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
1783
+ if (target) {
1784
+ const hooks = target[type] || (target[type] = []);
1785
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1786
+ reactivity.pauseTracking();
1787
+ const reset = setCurrentInstance(target);
1788
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
1789
+ reset();
1790
+ reactivity.resetTracking();
1791
+ return res;
1792
+ });
1793
+ if (prepend) {
1794
+ hooks.unshift(wrappedHook);
1795
+ } else {
1796
+ hooks.push(wrappedHook);
1789
1797
  }
1790
- return ctx;
1791
- }
1792
- };
1793
-
1794
- function watchEffect(effect, options) {
1795
- return doWatch(effect, null, options);
1796
- }
1797
- function watchPostEffect(effect, options) {
1798
- return doWatch(
1799
- effect,
1800
- null,
1801
- shared.extend({}, options, { flush: "post" })
1802
- );
1803
- }
1804
- function watchSyncEffect(effect, options) {
1805
- return doWatch(
1806
- effect,
1807
- null,
1808
- shared.extend({}, options, { flush: "sync" })
1809
- );
1810
- }
1811
- const INITIAL_WATCHER_VALUE = {};
1812
- function watch(source, cb, options) {
1813
- if (!shared.isFunction(cb)) {
1798
+ return wrappedHook;
1799
+ } else {
1800
+ const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
1814
1801
  warn$1(
1815
- `\`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.`
1802
+ `${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.` )
1816
1803
  );
1817
1804
  }
1818
- return doWatch(source, cb, options);
1819
1805
  }
1820
- function doWatch(source, cb, {
1821
- immediate,
1822
- deep,
1823
- flush,
1824
- once,
1825
- onTrack,
1826
- onTrigger
1827
- } = shared.EMPTY_OBJ) {
1828
- if (cb && once) {
1829
- const _cb = cb;
1830
- cb = (...args) => {
1831
- _cb(...args);
1832
- unwatch();
1833
- };
1806
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
1807
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
1808
+ injectHook(lifecycle, (...args) => hook(...args), target);
1834
1809
  }
1835
- if (deep !== void 0 && typeof deep === "number") {
1836
- warn$1(
1837
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
1838
- );
1810
+ };
1811
+ const onBeforeMount = createHook("bm");
1812
+ const onMounted = createHook("m");
1813
+ const onBeforeUpdate = createHook("bu");
1814
+ const onUpdated = createHook("u");
1815
+ const onBeforeUnmount = createHook("bum");
1816
+ const onUnmounted = createHook("um");
1817
+ const onServerPrefetch = createHook("sp");
1818
+ const onRenderTriggered = createHook(
1819
+ "rtg"
1820
+ );
1821
+ const onRenderTracked = createHook(
1822
+ "rtc"
1823
+ );
1824
+ function onErrorCaptured(hook, target = currentInstance) {
1825
+ injectHook("ec", hook, target);
1826
+ }
1827
+
1828
+ function validateDirectiveName(name) {
1829
+ if (shared.isBuiltInDirective(name)) {
1830
+ warn$1("Do not use built-in directive ids as custom directive id: " + name);
1839
1831
  }
1840
- if (!cb) {
1841
- if (immediate !== void 0) {
1842
- warn$1(
1843
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
1844
- );
1832
+ }
1833
+ function withDirectives(vnode, directives) {
1834
+ if (currentRenderingInstance === null) {
1835
+ warn$1(`withDirectives can only be used inside render functions.`);
1836
+ return vnode;
1837
+ }
1838
+ const instance = getComponentPublicInstance(currentRenderingInstance);
1839
+ const bindings = vnode.dirs || (vnode.dirs = []);
1840
+ for (let i = 0; i < directives.length; i++) {
1841
+ let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
1842
+ if (dir) {
1843
+ if (shared.isFunction(dir)) {
1844
+ dir = {
1845
+ mounted: dir,
1846
+ updated: dir
1847
+ };
1848
+ }
1849
+ if (dir.deep) {
1850
+ traverse(value);
1851
+ }
1852
+ bindings.push({
1853
+ dir,
1854
+ instance,
1855
+ value,
1856
+ oldValue: void 0,
1857
+ arg,
1858
+ modifiers
1859
+ });
1845
1860
  }
1846
- if (deep !== void 0) {
1847
- warn$1(
1848
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
1849
- );
1861
+ }
1862
+ return vnode;
1863
+ }
1864
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
1865
+ const bindings = vnode.dirs;
1866
+ const oldBindings = prevVNode && prevVNode.dirs;
1867
+ for (let i = 0; i < bindings.length; i++) {
1868
+ const binding = bindings[i];
1869
+ if (oldBindings) {
1870
+ binding.oldValue = oldBindings[i].value;
1850
1871
  }
1851
- if (once !== void 0) {
1852
- warn$1(
1853
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
1854
- );
1872
+ let hook = binding.dir[name];
1873
+ if (hook) {
1874
+ reactivity.pauseTracking();
1875
+ callWithAsyncErrorHandling(hook, instance, 8, [
1876
+ vnode.el,
1877
+ binding,
1878
+ vnode,
1879
+ prevVNode
1880
+ ]);
1881
+ reactivity.resetTracking();
1855
1882
  }
1856
1883
  }
1857
- const warnInvalidSource = (s) => {
1858
- warn$1(
1859
- `Invalid watch source: `,
1860
- s,
1861
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1862
- );
1863
- };
1864
- const instance = currentInstance;
1865
- const reactiveGetter = (source2) => deep === true ? source2 : (
1866
- // for deep: false, only traverse root-level properties
1867
- traverse(source2, deep === false ? 1 : void 0)
1868
- );
1869
- let getter;
1870
- let forceTrigger = false;
1871
- let isMultiSource = false;
1872
- if (reactivity.isRef(source)) {
1873
- getter = () => source.value;
1874
- forceTrigger = reactivity.isShallow(source);
1875
- } else if (reactivity.isReactive(source)) {
1876
- getter = () => reactiveGetter(source);
1877
- forceTrigger = true;
1878
- } else if (shared.isArray(source)) {
1879
- isMultiSource = true;
1880
- forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
1881
- getter = () => source.map((s) => {
1882
- if (reactivity.isRef(s)) {
1883
- return s.value;
1884
- } else if (reactivity.isReactive(s)) {
1885
- return reactiveGetter(s);
1886
- } else if (shared.isFunction(s)) {
1887
- return callWithErrorHandling(s, instance, 2);
1888
- } else {
1889
- warnInvalidSource(s);
1890
- }
1891
- });
1892
- } else if (shared.isFunction(source)) {
1893
- if (cb) {
1894
- getter = () => callWithErrorHandling(source, instance, 2);
1884
+ }
1885
+
1886
+ function renderList(source, renderItem, cache, index) {
1887
+ let ret;
1888
+ const cached = cache && cache[index];
1889
+ if (shared.isArray(source) || shared.isString(source)) {
1890
+ ret = new Array(source.length);
1891
+ for (let i = 0, l = source.length; i < l; i++) {
1892
+ ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
1893
+ }
1894
+ } else if (typeof source === "number") {
1895
+ if (!Number.isInteger(source)) {
1896
+ warn$1(`The v-for range expect an integer value but got ${source}.`);
1897
+ }
1898
+ ret = new Array(source);
1899
+ for (let i = 0; i < source; i++) {
1900
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1901
+ }
1902
+ } else if (shared.isObject(source)) {
1903
+ if (source[Symbol.iterator]) {
1904
+ ret = Array.from(
1905
+ source,
1906
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
1907
+ );
1895
1908
  } else {
1896
- getter = () => {
1897
- if (cleanup) {
1898
- cleanup();
1899
- }
1900
- return callWithAsyncErrorHandling(
1901
- source,
1902
- instance,
1903
- 3,
1904
- [onCleanup]
1905
- );
1906
- };
1909
+ const keys = Object.keys(source);
1910
+ ret = new Array(keys.length);
1911
+ for (let i = 0, l = keys.length; i < l; i++) {
1912
+ const key = keys[i];
1913
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1914
+ }
1907
1915
  }
1908
1916
  } else {
1909
- getter = shared.NOOP;
1910
- warnInvalidSource(source);
1917
+ ret = [];
1911
1918
  }
1912
- if (cb && deep) {
1913
- const baseGetter = getter;
1914
- getter = () => traverse(baseGetter());
1919
+ if (cache) {
1920
+ cache[index] = ret;
1915
1921
  }
1916
- let cleanup;
1917
- let onCleanup = (fn) => {
1918
- cleanup = effect.onStop = () => {
1919
- callWithErrorHandling(fn, instance, 4);
1920
- cleanup = effect.onStop = void 0;
1921
- };
1922
- };
1923
- let ssrCleanup;
1924
- if (isInSSRComponentSetup) {
1925
- onCleanup = shared.NOOP;
1926
- if (!cb) {
1927
- getter();
1928
- } else if (immediate) {
1929
- callWithAsyncErrorHandling(cb, instance, 3, [
1930
- getter(),
1931
- isMultiSource ? [] : void 0,
1932
- onCleanup
1933
- ]);
1934
- }
1935
- if (flush === "sync") {
1936
- const ctx = useSSRContext();
1937
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1938
- } else {
1939
- return shared.NOOP;
1940
- }
1941
- }
1942
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1943
- const job = () => {
1944
- if (!effect.active || !effect.dirty) {
1945
- return;
1946
- }
1947
- if (cb) {
1948
- const newValue = effect.run();
1949
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
1950
- if (cleanup) {
1951
- cleanup();
1952
- }
1953
- callWithAsyncErrorHandling(cb, instance, 3, [
1954
- newValue,
1955
- // pass undefined as the old value when it's changed for the first time
1956
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1957
- onCleanup
1958
- ]);
1959
- oldValue = newValue;
1960
- }
1961
- } else {
1962
- effect.run();
1963
- }
1964
- };
1965
- job.allowRecurse = !!cb;
1966
- let scheduler;
1967
- if (flush === "sync") {
1968
- scheduler = job;
1969
- } else if (flush === "post") {
1970
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1971
- } else {
1972
- job.pre = true;
1973
- if (instance)
1974
- job.id = instance.uid;
1975
- scheduler = () => queueJob(job);
1976
- }
1977
- const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
1978
- const scope = reactivity.getCurrentScope();
1979
- const unwatch = () => {
1980
- effect.stop();
1981
- if (scope) {
1982
- shared.remove(scope.effects, effect);
1983
- }
1984
- };
1985
- {
1986
- effect.onTrack = onTrack;
1987
- effect.onTrigger = onTrigger;
1988
- }
1989
- if (cb) {
1990
- if (immediate) {
1991
- job();
1992
- } else {
1993
- oldValue = effect.run();
1994
- }
1995
- } else if (flush === "post") {
1996
- queuePostRenderEffect(
1997
- effect.run.bind(effect),
1998
- instance && instance.suspense
1999
- );
2000
- } else {
2001
- effect.run();
2002
- }
2003
- if (ssrCleanup)
2004
- ssrCleanup.push(unwatch);
2005
- return unwatch;
2006
- }
2007
- function instanceWatch(source, value, options) {
2008
- const publicThis = this.proxy;
2009
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
2010
- let cb;
2011
- if (shared.isFunction(value)) {
2012
- cb = value;
2013
- } else {
2014
- cb = value.handler;
2015
- options = value;
2016
- }
2017
- const reset = setCurrentInstance(this);
2018
- const res = doWatch(getter, cb.bind(publicThis), options);
2019
- reset();
2020
- return res;
2021
- }
2022
- function createPathGetter(ctx, path) {
2023
- const segments = path.split(".");
2024
- return () => {
2025
- let cur = ctx;
2026
- for (let i = 0; i < segments.length && cur; i++) {
2027
- cur = cur[segments[i]];
2028
- }
2029
- return cur;
2030
- };
2031
- }
2032
- function traverse(value, depth = Infinity, seen) {
2033
- if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
2034
- return value;
2035
- }
2036
- seen = seen || /* @__PURE__ */ new Set();
2037
- if (seen.has(value)) {
2038
- return value;
2039
- }
2040
- seen.add(value);
2041
- depth--;
2042
- if (reactivity.isRef(value)) {
2043
- traverse(value.value, depth, seen);
2044
- } else if (shared.isArray(value)) {
2045
- for (let i = 0; i < value.length; i++) {
2046
- traverse(value[i], depth, seen);
2047
- }
2048
- } else if (shared.isSet(value) || shared.isMap(value)) {
2049
- value.forEach((v) => {
2050
- traverse(v, depth, seen);
2051
- });
2052
- } else if (shared.isPlainObject(value)) {
2053
- for (const key in value) {
2054
- traverse(value[key], depth, seen);
2055
- }
2056
- }
2057
- return value;
1922
+ return ret;
2058
1923
  }
2059
1924
 
2060
- function validateDirectiveName(name) {
2061
- if (shared.isBuiltInDirective(name)) {
2062
- warn$1("Do not use built-in directive ids as custom directive id: " + name);
2063
- }
2064
- }
2065
- function withDirectives(vnode, directives) {
2066
- if (currentRenderingInstance === null) {
2067
- warn$1(`withDirectives can only be used inside render functions.`);
2068
- return vnode;
2069
- }
2070
- const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2071
- const bindings = vnode.dirs || (vnode.dirs = []);
2072
- for (let i = 0; i < directives.length; i++) {
2073
- let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
2074
- if (dir) {
2075
- if (shared.isFunction(dir)) {
2076
- dir = {
2077
- mounted: dir,
2078
- updated: dir
2079
- };
2080
- }
2081
- if (dir.deep) {
2082
- traverse(value);
1925
+ function createSlots(slots, dynamicSlots) {
1926
+ for (let i = 0; i < dynamicSlots.length; i++) {
1927
+ const slot = dynamicSlots[i];
1928
+ if (shared.isArray(slot)) {
1929
+ for (let j = 0; j < slot.length; j++) {
1930
+ slots[slot[j].name] = slot[j].fn;
2083
1931
  }
2084
- bindings.push({
2085
- dir,
2086
- instance,
2087
- value,
2088
- oldValue: void 0,
2089
- arg,
2090
- modifiers
2091
- });
1932
+ } else if (slot) {
1933
+ slots[slot.name] = slot.key ? (...args) => {
1934
+ const res = slot.fn(...args);
1935
+ if (res) res.key = slot.key;
1936
+ return res;
1937
+ } : slot.fn;
2092
1938
  }
2093
1939
  }
2094
- return vnode;
1940
+ return slots;
2095
1941
  }
2096
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2097
- const bindings = vnode.dirs;
2098
- const oldBindings = prevVNode && prevVNode.dirs;
2099
- for (let i = 0; i < bindings.length; i++) {
2100
- const binding = bindings[i];
2101
- if (oldBindings) {
2102
- binding.oldValue = oldBindings[i].value;
2103
- }
2104
- let hook = binding.dir[name];
2105
- if (hook) {
2106
- reactivity.pauseTracking();
2107
- callWithAsyncErrorHandling(hook, instance, 8, [
2108
- vnode.el,
2109
- binding,
2110
- vnode,
2111
- prevVNode
2112
- ]);
2113
- reactivity.resetTracking();
2114
- }
2115
- }
1942
+
1943
+ /*! #__NO_SIDE_EFFECTS__ */
1944
+ // @__NO_SIDE_EFFECTS__
1945
+ function defineComponent(options, extraOptions) {
1946
+ return shared.isFunction(options) ? (
1947
+ // #8326: extend call and options.name access are considered side-effects
1948
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1949
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1950
+ ) : options;
2116
1951
  }
2117
1952
 
2118
- const leaveCbKey = Symbol("_leaveCb");
2119
- const enterCbKey = Symbol("_enterCb");
2120
- function useTransitionState() {
2121
- const state = {
2122
- isMounted: false,
2123
- isLeaving: false,
2124
- isUnmounting: false,
2125
- leavingVNodes: /* @__PURE__ */ new Map()
1953
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1954
+ /*! #__NO_SIDE_EFFECTS__ */
1955
+ // @__NO_SIDE_EFFECTS__
1956
+ function defineAsyncComponent(source) {
1957
+ if (shared.isFunction(source)) {
1958
+ source = { loader: source };
1959
+ }
1960
+ const {
1961
+ loader,
1962
+ loadingComponent,
1963
+ errorComponent,
1964
+ delay = 200,
1965
+ timeout,
1966
+ // undefined = never times out
1967
+ suspensible = true,
1968
+ onError: userOnError
1969
+ } = source;
1970
+ let pendingRequest = null;
1971
+ let resolvedComp;
1972
+ let retries = 0;
1973
+ const retry = () => {
1974
+ retries++;
1975
+ pendingRequest = null;
1976
+ return load();
2126
1977
  };
2127
- onMounted(() => {
2128
- state.isMounted = true;
2129
- });
2130
- onBeforeUnmount(() => {
2131
- state.isUnmounting = true;
2132
- });
2133
- return state;
2134
- }
2135
- const TransitionHookValidator = [Function, Array];
2136
- const BaseTransitionPropsValidators = {
2137
- mode: String,
2138
- appear: Boolean,
2139
- persisted: Boolean,
2140
- // enter
2141
- onBeforeEnter: TransitionHookValidator,
2142
- onEnter: TransitionHookValidator,
2143
- onAfterEnter: TransitionHookValidator,
2144
- onEnterCancelled: TransitionHookValidator,
2145
- // leave
2146
- onBeforeLeave: TransitionHookValidator,
2147
- onLeave: TransitionHookValidator,
2148
- onAfterLeave: TransitionHookValidator,
2149
- onLeaveCancelled: TransitionHookValidator,
2150
- // appear
2151
- onBeforeAppear: TransitionHookValidator,
2152
- onAppear: TransitionHookValidator,
2153
- onAfterAppear: TransitionHookValidator,
2154
- onAppearCancelled: TransitionHookValidator
2155
- };
2156
- const BaseTransitionImpl = {
2157
- name: `BaseTransition`,
2158
- props: BaseTransitionPropsValidators,
2159
- setup(props, { slots }) {
2160
- const instance = getCurrentInstance();
2161
- const state = useTransitionState();
2162
- return () => {
2163
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
2164
- if (!children || !children.length) {
2165
- return;
2166
- }
2167
- let child = children[0];
2168
- if (children.length > 1) {
2169
- let hasFound = false;
2170
- for (const c of children) {
2171
- if (c.type !== Comment) {
2172
- if (hasFound) {
2173
- warn$1(
2174
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
2175
- );
2176
- break;
2177
- }
2178
- child = c;
2179
- hasFound = true;
2180
- }
2181
- }
1978
+ const load = () => {
1979
+ let thisRequest;
1980
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1981
+ err = err instanceof Error ? err : new Error(String(err));
1982
+ if (userOnError) {
1983
+ return new Promise((resolve, reject) => {
1984
+ const userRetry = () => resolve(retry());
1985
+ const userFail = () => reject(err);
1986
+ userOnError(err, userRetry, userFail, retries + 1);
1987
+ });
1988
+ } else {
1989
+ throw err;
2182
1990
  }
2183
- const rawProps = reactivity.toRaw(props);
2184
- const { mode } = rawProps;
2185
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
2186
- warn$1(`invalid <transition> mode: ${mode}`);
1991
+ }).then((comp) => {
1992
+ if (thisRequest !== pendingRequest && pendingRequest) {
1993
+ return pendingRequest;
2187
1994
  }
2188
- if (state.isLeaving) {
2189
- return emptyPlaceholder(child);
1995
+ if (!comp) {
1996
+ warn$1(
1997
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
1998
+ );
2190
1999
  }
2191
- const innerChild = getKeepAliveChild(child);
2192
- if (!innerChild) {
2193
- return emptyPlaceholder(child);
2000
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2001
+ comp = comp.default;
2194
2002
  }
2195
- const enterHooks = resolveTransitionHooks(
2196
- innerChild,
2197
- rawProps,
2198
- state,
2199
- instance
2200
- );
2201
- setTransitionHooks(innerChild, enterHooks);
2202
- const oldChild = instance.subTree;
2203
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2204
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
2205
- const leavingHooks = resolveTransitionHooks(
2206
- oldInnerChild,
2207
- rawProps,
2208
- state,
2209
- instance
2210
- );
2211
- setTransitionHooks(oldInnerChild, leavingHooks);
2212
- if (mode === "out-in" && innerChild.type !== Comment) {
2213
- state.isLeaving = true;
2214
- leavingHooks.afterLeave = () => {
2215
- state.isLeaving = false;
2216
- if (instance.update.active !== false) {
2217
- instance.effect.dirty = true;
2218
- instance.update();
2219
- }
2220
- };
2221
- return emptyPlaceholder(child);
2222
- } else if (mode === "in-out" && innerChild.type !== Comment) {
2223
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2224
- const leavingVNodesCache = getLeavingNodesForType(
2225
- state,
2226
- oldInnerChild
2227
- );
2228
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2229
- el[leaveCbKey] = () => {
2230
- earlyRemove();
2231
- el[leaveCbKey] = void 0;
2232
- delete enterHooks.delayedLeave;
2233
- };
2234
- enterHooks.delayedLeave = delayedLeave;
2235
- };
2236
- }
2003
+ if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
2004
+ throw new Error(`Invalid async component load result: ${comp}`);
2237
2005
  }
2238
- return child;
2239
- };
2240
- }
2241
- };
2242
- const BaseTransition = BaseTransitionImpl;
2243
- function getLeavingNodesForType(state, vnode) {
2244
- const { leavingVNodes } = state;
2245
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
2246
- if (!leavingVNodesCache) {
2247
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2248
- leavingVNodes.set(vnode.type, leavingVNodesCache);
2249
- }
2250
- return leavingVNodesCache;
2251
- }
2252
- function resolveTransitionHooks(vnode, props, state, instance) {
2253
- const {
2254
- appear,
2255
- mode,
2256
- persisted = false,
2257
- onBeforeEnter,
2258
- onEnter,
2259
- onAfterEnter,
2260
- onEnterCancelled,
2261
- onBeforeLeave,
2262
- onLeave,
2263
- onAfterLeave,
2264
- onLeaveCancelled,
2265
- onBeforeAppear,
2266
- onAppear,
2267
- onAfterAppear,
2268
- onAppearCancelled
2269
- } = props;
2270
- const key = String(vnode.key);
2271
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2272
- const callHook = (hook, args) => {
2273
- hook && callWithAsyncErrorHandling(
2274
- hook,
2275
- instance,
2276
- 9,
2277
- args
2278
- );
2279
- };
2280
- const callAsyncHook = (hook, args) => {
2281
- const done = args[1];
2282
- callHook(hook, args);
2283
- if (shared.isArray(hook)) {
2284
- if (hook.every((hook2) => hook2.length <= 1))
2285
- done();
2286
- } else if (hook.length <= 1) {
2287
- done();
2288
- }
2006
+ resolvedComp = comp;
2007
+ return comp;
2008
+ }));
2289
2009
  };
2290
- const hooks = {
2291
- mode,
2292
- persisted,
2293
- beforeEnter(el) {
2294
- let hook = onBeforeEnter;
2295
- if (!state.isMounted) {
2296
- if (appear) {
2297
- hook = onBeforeAppear || onBeforeEnter;
2298
- } else {
2299
- return;
2300
- }
2010
+ return defineComponent({
2011
+ name: "AsyncComponentWrapper",
2012
+ __asyncLoader: load,
2013
+ get __asyncResolved() {
2014
+ return resolvedComp;
2015
+ },
2016
+ setup() {
2017
+ const instance = currentInstance;
2018
+ if (resolvedComp) {
2019
+ return () => createInnerComp(resolvedComp, instance);
2301
2020
  }
2302
- if (el[leaveCbKey]) {
2303
- el[leaveCbKey](
2304
- true
2305
- /* cancelled */
2021
+ const onError = (err) => {
2022
+ pendingRequest = null;
2023
+ handleError(
2024
+ err,
2025
+ instance,
2026
+ 13,
2027
+ !errorComponent
2306
2028
  );
2029
+ };
2030
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
2031
+ return load().then((comp) => {
2032
+ return () => createInnerComp(comp, instance);
2033
+ }).catch((err) => {
2034
+ onError(err);
2035
+ return () => errorComponent ? createVNode(errorComponent, {
2036
+ error: err
2037
+ }) : null;
2038
+ });
2307
2039
  }
2308
- const leavingVNode = leavingVNodesCache[key];
2309
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
2310
- leavingVNode.el[leaveCbKey]();
2040
+ const loaded = reactivity.ref(false);
2041
+ const error = reactivity.ref();
2042
+ const delayed = reactivity.ref(!!delay);
2043
+ if (delay) {
2044
+ setTimeout(() => {
2045
+ delayed.value = false;
2046
+ }, delay);
2311
2047
  }
2312
- callHook(hook, [el]);
2313
- },
2314
- enter(el) {
2315
- let hook = onEnter;
2316
- let afterHook = onAfterEnter;
2317
- let cancelHook = onEnterCancelled;
2318
- if (!state.isMounted) {
2319
- if (appear) {
2320
- hook = onAppear || onEnter;
2321
- afterHook = onAfterAppear || onAfterEnter;
2322
- cancelHook = onAppearCancelled || onEnterCancelled;
2323
- } else {
2324
- return;
2325
- }
2048
+ if (timeout != null) {
2049
+ setTimeout(() => {
2050
+ if (!loaded.value && !error.value) {
2051
+ const err = new Error(
2052
+ `Async component timed out after ${timeout}ms.`
2053
+ );
2054
+ onError(err);
2055
+ error.value = err;
2056
+ }
2057
+ }, timeout);
2326
2058
  }
2327
- let called = false;
2328
- const done = el[enterCbKey] = (cancelled) => {
2329
- if (called)
2330
- return;
2331
- called = true;
2332
- if (cancelled) {
2333
- callHook(cancelHook, [el]);
2334
- } else {
2335
- callHook(afterHook, [el]);
2336
- }
2337
- if (hooks.delayedLeave) {
2338
- hooks.delayedLeave();
2339
- }
2340
- el[enterCbKey] = void 0;
2341
- };
2342
- if (hook) {
2343
- callAsyncHook(hook, [el, done]);
2344
- } else {
2345
- done();
2346
- }
2347
- },
2348
- leave(el, remove) {
2349
- const key2 = String(vnode.key);
2350
- if (el[enterCbKey]) {
2351
- el[enterCbKey](
2352
- true
2353
- /* cancelled */
2354
- );
2355
- }
2356
- if (state.isUnmounting) {
2357
- return remove();
2358
- }
2359
- callHook(onBeforeLeave, [el]);
2360
- let called = false;
2361
- const done = el[leaveCbKey] = (cancelled) => {
2362
- if (called)
2363
- return;
2364
- called = true;
2365
- remove();
2366
- if (cancelled) {
2367
- callHook(onLeaveCancelled, [el]);
2368
- } else {
2369
- callHook(onAfterLeave, [el]);
2370
- }
2371
- el[leaveCbKey] = void 0;
2372
- if (leavingVNodesCache[key2] === vnode) {
2373
- delete leavingVNodesCache[key2];
2374
- }
2375
- };
2376
- leavingVNodesCache[key2] = vnode;
2377
- if (onLeave) {
2378
- callAsyncHook(onLeave, [el, done]);
2379
- } else {
2380
- done();
2381
- }
2382
- },
2383
- clone(vnode2) {
2384
- return resolveTransitionHooks(vnode2, props, state, instance);
2385
- }
2386
- };
2387
- return hooks;
2388
- }
2389
- function emptyPlaceholder(vnode) {
2390
- if (isKeepAlive(vnode)) {
2391
- vnode = cloneVNode(vnode);
2392
- vnode.children = null;
2393
- return vnode;
2394
- }
2395
- }
2396
- function getKeepAliveChild(vnode) {
2397
- if (!isKeepAlive(vnode)) {
2398
- return vnode;
2399
- }
2400
- if (vnode.component) {
2401
- return vnode.component.subTree;
2402
- }
2403
- const { shapeFlag, children } = vnode;
2404
- if (children) {
2405
- if (shapeFlag & 16) {
2406
- return children[0];
2407
- }
2408
- if (shapeFlag & 32 && shared.isFunction(children.default)) {
2409
- return children.default();
2410
- }
2411
- }
2412
- }
2413
- function setTransitionHooks(vnode, hooks) {
2414
- if (vnode.shapeFlag & 6 && vnode.component) {
2415
- setTransitionHooks(vnode.component.subTree, hooks);
2416
- } else if (vnode.shapeFlag & 128) {
2417
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2418
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2419
- } else {
2420
- vnode.transition = hooks;
2421
- }
2422
- }
2423
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
2424
- let ret = [];
2425
- let keyedFragmentCount = 0;
2426
- for (let i = 0; i < children.length; i++) {
2427
- let child = children[i];
2428
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2429
- if (child.type === Fragment) {
2430
- if (child.patchFlag & 128)
2431
- keyedFragmentCount++;
2432
- ret = ret.concat(
2433
- getTransitionRawChildren(child.children, keepComment, key)
2434
- );
2435
- } else if (keepComment || child.type !== Comment) {
2436
- ret.push(key != null ? cloneVNode(child, { key }) : child);
2437
- }
2438
- }
2439
- if (keyedFragmentCount > 1) {
2440
- for (let i = 0; i < ret.length; i++) {
2441
- ret[i].patchFlag = -2;
2442
- }
2443
- }
2444
- return ret;
2445
- }
2446
-
2447
- /*! #__NO_SIDE_EFFECTS__ */
2448
- // @__NO_SIDE_EFFECTS__
2449
- function defineComponent(options, extraOptions) {
2450
- return shared.isFunction(options) ? (
2451
- // #8326: extend call and options.name access are considered side-effects
2452
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2453
- /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
2454
- ) : options;
2455
- }
2456
-
2457
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2458
- /*! #__NO_SIDE_EFFECTS__ */
2459
- // @__NO_SIDE_EFFECTS__
2460
- function defineAsyncComponent(source) {
2461
- if (shared.isFunction(source)) {
2462
- source = { loader: source };
2463
- }
2464
- const {
2465
- loader,
2466
- loadingComponent,
2467
- errorComponent,
2468
- delay = 200,
2469
- timeout,
2470
- // undefined = never times out
2471
- suspensible = true,
2472
- onError: userOnError
2473
- } = source;
2474
- let pendingRequest = null;
2475
- let resolvedComp;
2476
- let retries = 0;
2477
- const retry = () => {
2478
- retries++;
2479
- pendingRequest = null;
2480
- return load();
2481
- };
2482
- const load = () => {
2483
- let thisRequest;
2484
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2485
- err = err instanceof Error ? err : new Error(String(err));
2486
- if (userOnError) {
2487
- return new Promise((resolve, reject) => {
2488
- const userRetry = () => resolve(retry());
2489
- const userFail = () => reject(err);
2490
- userOnError(err, userRetry, userFail, retries + 1);
2491
- });
2492
- } else {
2493
- throw err;
2494
- }
2495
- }).then((comp) => {
2496
- if (thisRequest !== pendingRequest && pendingRequest) {
2497
- return pendingRequest;
2498
- }
2499
- if (!comp) {
2500
- warn$1(
2501
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
2502
- );
2503
- }
2504
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2505
- comp = comp.default;
2506
- }
2507
- if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
2508
- throw new Error(`Invalid async component load result: ${comp}`);
2509
- }
2510
- resolvedComp = comp;
2511
- return comp;
2512
- }));
2513
- };
2514
- return defineComponent({
2515
- name: "AsyncComponentWrapper",
2516
- __asyncLoader: load,
2517
- get __asyncResolved() {
2518
- return resolvedComp;
2519
- },
2520
- setup() {
2521
- const instance = currentInstance;
2522
- if (resolvedComp) {
2523
- return () => createInnerComp(resolvedComp, instance);
2524
- }
2525
- const onError = (err) => {
2526
- pendingRequest = null;
2527
- handleError(
2528
- err,
2529
- instance,
2530
- 13,
2531
- !errorComponent
2532
- );
2533
- };
2534
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
2535
- return load().then((comp) => {
2536
- return () => createInnerComp(comp, instance);
2537
- }).catch((err) => {
2538
- onError(err);
2539
- return () => errorComponent ? createVNode(errorComponent, {
2540
- error: err
2541
- }) : null;
2542
- });
2543
- }
2544
- const loaded = reactivity.ref(false);
2545
- const error = reactivity.ref();
2546
- const delayed = reactivity.ref(!!delay);
2547
- if (delay) {
2548
- setTimeout(() => {
2549
- delayed.value = false;
2550
- }, delay);
2551
- }
2552
- if (timeout != null) {
2553
- setTimeout(() => {
2554
- if (!loaded.value && !error.value) {
2555
- const err = new Error(
2556
- `Async component timed out after ${timeout}ms.`
2557
- );
2558
- onError(err);
2559
- error.value = err;
2560
- }
2561
- }, timeout);
2562
- }
2563
- load().then(() => {
2564
- loaded.value = true;
2565
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2566
- instance.parent.effect.dirty = true;
2567
- queueJob(instance.parent.update);
2059
+ load().then(() => {
2060
+ loaded.value = true;
2061
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2062
+ instance.parent.effect.dirty = true;
2063
+ queueJob(instance.parent.update);
2568
2064
  }
2569
2065
  }).catch((err) => {
2570
2066
  onError(err);
@@ -2593,427 +2089,66 @@ function createInnerComp(comp, parent) {
2593
2089
  return vnode;
2594
2090
  }
2595
2091
 
2596
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2597
- const KeepAliveImpl = {
2598
- name: `KeepAlive`,
2599
- // Marker for special handling inside the renderer. We are not using a ===
2600
- // check directly on KeepAlive in the renderer, because importing it directly
2601
- // would prevent it from being tree-shaken.
2602
- __isKeepAlive: true,
2603
- props: {
2604
- include: [String, RegExp, Array],
2605
- exclude: [String, RegExp, Array],
2606
- max: [String, Number]
2607
- },
2608
- setup(props, { slots }) {
2609
- const instance = getCurrentInstance();
2610
- const sharedContext = instance.ctx;
2611
- if (!sharedContext.renderer) {
2612
- return () => {
2613
- const children = slots.default && slots.default();
2614
- return children && children.length === 1 ? children[0] : children;
2615
- };
2616
- }
2617
- const cache = /* @__PURE__ */ new Map();
2618
- const keys = /* @__PURE__ */ new Set();
2619
- let current = null;
2620
- {
2621
- instance.__v_cache = cache;
2622
- }
2623
- const parentSuspense = instance.suspense;
2624
- const {
2625
- renderer: {
2626
- p: patch,
2627
- m: move,
2628
- um: _unmount,
2629
- o: { createElement }
2630
- }
2631
- } = sharedContext;
2632
- const storageContainer = createElement("div");
2633
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2634
- const instance2 = vnode.component;
2635
- move(vnode, container, anchor, 0, parentSuspense);
2636
- patch(
2637
- instance2.vnode,
2638
- vnode,
2639
- container,
2640
- anchor,
2641
- instance2,
2642
- parentSuspense,
2643
- namespace,
2644
- vnode.slotScopeIds,
2645
- optimized
2646
- );
2647
- queuePostRenderEffect(() => {
2648
- instance2.isDeactivated = false;
2649
- if (instance2.a) {
2650
- shared.invokeArrayFns(instance2.a);
2651
- }
2652
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2653
- if (vnodeHook) {
2654
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2655
- }
2656
- }, parentSuspense);
2657
- {
2658
- devtoolsComponentAdded(instance2);
2659
- }
2660
- };
2661
- sharedContext.deactivate = (vnode) => {
2662
- const instance2 = vnode.component;
2663
- move(vnode, storageContainer, null, 1, parentSuspense);
2664
- queuePostRenderEffect(() => {
2665
- if (instance2.da) {
2666
- shared.invokeArrayFns(instance2.da);
2667
- }
2668
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2669
- if (vnodeHook) {
2670
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2671
- }
2672
- instance2.isDeactivated = true;
2673
- }, parentSuspense);
2674
- {
2675
- devtoolsComponentAdded(instance2);
2676
- }
2677
- };
2678
- function unmount(vnode) {
2679
- resetShapeFlag(vnode);
2680
- _unmount(vnode, instance, parentSuspense, true);
2681
- }
2682
- function pruneCache(filter) {
2683
- cache.forEach((vnode, key) => {
2684
- const name = getComponentName(vnode.type);
2685
- if (name && (!filter || !filter(name))) {
2686
- pruneCacheEntry(key);
2687
- }
2688
- });
2689
- }
2690
- function pruneCacheEntry(key) {
2691
- const cached = cache.get(key);
2692
- if (!current || !isSameVNodeType(cached, current)) {
2693
- unmount(cached);
2694
- } else if (current) {
2695
- resetShapeFlag(current);
2696
- }
2697
- cache.delete(key);
2698
- keys.delete(key);
2699
- }
2700
- watch(
2701
- () => [props.include, props.exclude],
2702
- ([include, exclude]) => {
2703
- include && pruneCache((name) => matches(include, name));
2704
- exclude && pruneCache((name) => !matches(exclude, name));
2705
- },
2706
- // prune post-render after `current` has been updated
2707
- { flush: "post", deep: true }
2708
- );
2709
- let pendingCacheKey = null;
2710
- const cacheSubtree = () => {
2711
- if (pendingCacheKey != null) {
2712
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2713
- }
2714
- };
2715
- onMounted(cacheSubtree);
2716
- onUpdated(cacheSubtree);
2717
- onBeforeUnmount(() => {
2718
- cache.forEach((cached) => {
2719
- const { subTree, suspense } = instance;
2720
- const vnode = getInnerChild(subTree);
2721
- if (cached.type === vnode.type && cached.key === vnode.key) {
2722
- resetShapeFlag(vnode);
2723
- const da = vnode.component.da;
2724
- da && queuePostRenderEffect(da, suspense);
2725
- return;
2726
- }
2727
- unmount(cached);
2728
- });
2729
- });
2730
- return () => {
2731
- pendingCacheKey = null;
2732
- if (!slots.default) {
2733
- return null;
2734
- }
2735
- const children = slots.default();
2736
- const rawVNode = children[0];
2737
- if (children.length > 1) {
2738
- {
2739
- warn$1(`KeepAlive should contain exactly one component child.`);
2740
- }
2741
- current = null;
2742
- return children;
2743
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2744
- current = null;
2745
- return rawVNode;
2746
- }
2747
- let vnode = getInnerChild(rawVNode);
2748
- const comp = vnode.type;
2749
- const name = getComponentName(
2750
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2751
- );
2752
- const { include, exclude, max } = props;
2753
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2754
- current = vnode;
2755
- return rawVNode;
2756
- }
2757
- const key = vnode.key == null ? comp : vnode.key;
2758
- const cachedVNode = cache.get(key);
2759
- if (vnode.el) {
2760
- vnode = cloneVNode(vnode);
2761
- if (rawVNode.shapeFlag & 128) {
2762
- rawVNode.ssContent = vnode;
2763
- }
2764
- }
2765
- pendingCacheKey = key;
2766
- if (cachedVNode) {
2767
- vnode.el = cachedVNode.el;
2768
- vnode.component = cachedVNode.component;
2769
- if (vnode.transition) {
2770
- setTransitionHooks(vnode, vnode.transition);
2771
- }
2772
- vnode.shapeFlag |= 512;
2773
- keys.delete(key);
2774
- keys.add(key);
2775
- } else {
2776
- keys.add(key);
2777
- if (max && keys.size > parseInt(max, 10)) {
2778
- pruneCacheEntry(keys.values().next().value);
2779
- }
2780
- }
2781
- vnode.shapeFlag |= 256;
2782
- current = vnode;
2783
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
2784
- };
2092
+ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2093
+ if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2094
+ if (name !== "default") props.name = name;
2095
+ return createVNode("slot", props, fallback && fallback());
2785
2096
  }
2786
- };
2787
- const KeepAlive = KeepAliveImpl;
2788
- function matches(pattern, name) {
2789
- if (shared.isArray(pattern)) {
2790
- return pattern.some((p) => matches(p, name));
2791
- } else if (shared.isString(pattern)) {
2792
- return pattern.split(",").includes(name);
2793
- } else if (shared.isRegExp(pattern)) {
2794
- return pattern.test(name);
2097
+ let slot = slots[name];
2098
+ if (slot && slot.length > 1) {
2099
+ warn$1(
2100
+ `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.`
2101
+ );
2102
+ slot = () => [];
2795
2103
  }
2796
- return false;
2797
- }
2798
- function onActivated(hook, target) {
2799
- registerKeepAliveHook(hook, "a", target);
2800
- }
2801
- function onDeactivated(hook, target) {
2802
- registerKeepAliveHook(hook, "da", target);
2803
- }
2804
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2805
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2806
- let current = target;
2807
- while (current) {
2808
- if (current.isDeactivated) {
2809
- return;
2810
- }
2811
- current = current.parent;
2812
- }
2813
- return hook();
2814
- });
2815
- injectHook(type, wrappedHook, target);
2816
- if (target) {
2817
- let current = target.parent;
2818
- while (current && current.parent) {
2819
- if (isKeepAlive(current.parent.vnode)) {
2820
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2821
- }
2822
- current = current.parent;
2823
- }
2104
+ if (slot && slot._c) {
2105
+ slot._d = false;
2824
2106
  }
2825
- }
2826
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2827
- const injected = injectHook(
2828
- type,
2829
- hook,
2830
- keepAliveRoot,
2831
- true
2832
- /* prepend */
2107
+ openBlock();
2108
+ const validSlotContent = slot && ensureValidVNode(slot(props));
2109
+ const rendered = createBlock(
2110
+ Fragment,
2111
+ {
2112
+ key: props.key || // slot content array of a dynamic conditional slot may have a branch
2113
+ // key attached in the `createSlots` helper, respect that
2114
+ validSlotContent && validSlotContent.key || `_${name}`
2115
+ },
2116
+ validSlotContent || (fallback ? fallback() : []),
2117
+ validSlotContent && slots._ === 1 ? 64 : -2
2833
2118
  );
2834
- onUnmounted(() => {
2835
- shared.remove(keepAliveRoot[type], injected);
2836
- }, target);
2119
+ if (!noSlotted && rendered.scopeId) {
2120
+ rendered.slotScopeIds = [rendered.scopeId + "-s"];
2121
+ }
2122
+ if (slot && slot._c) {
2123
+ slot._d = true;
2124
+ }
2125
+ return rendered;
2837
2126
  }
2838
- function resetShapeFlag(vnode) {
2839
- vnode.shapeFlag &= ~256;
2840
- vnode.shapeFlag &= ~512;
2127
+ function ensureValidVNode(vnodes) {
2128
+ return vnodes.some((child) => {
2129
+ if (!isVNode(child)) return true;
2130
+ if (child.type === Comment) return false;
2131
+ if (child.type === Fragment && !ensureValidVNode(child.children))
2132
+ return false;
2133
+ return true;
2134
+ }) ? vnodes : null;
2841
2135
  }
2842
- function getInnerChild(vnode) {
2843
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2844
- }
2845
-
2846
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2847
- if (target) {
2848
- const hooks = target[type] || (target[type] = []);
2849
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2850
- if (target.isUnmounted) {
2851
- return;
2852
- }
2853
- reactivity.pauseTracking();
2854
- const reset = setCurrentInstance(target);
2855
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2856
- reset();
2857
- reactivity.resetTracking();
2858
- return res;
2859
- });
2860
- if (prepend) {
2861
- hooks.unshift(wrappedHook);
2862
- } else {
2863
- hooks.push(wrappedHook);
2864
- }
2865
- return wrappedHook;
2866
- } else {
2867
- const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
2868
- warn$1(
2869
- `${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.` )
2870
- );
2871
- }
2872
- }
2873
- const createHook = (lifecycle) => (hook, target = currentInstance) => (
2874
- // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
2875
- (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
2876
- );
2877
- const onBeforeMount = createHook("bm");
2878
- const onMounted = createHook("m");
2879
- const onBeforeUpdate = createHook("bu");
2880
- const onUpdated = createHook("u");
2881
- const onBeforeUnmount = createHook("bum");
2882
- const onUnmounted = createHook("um");
2883
- const onServerPrefetch = createHook("sp");
2884
- const onRenderTriggered = createHook(
2885
- "rtg"
2886
- );
2887
- const onRenderTracked = createHook(
2888
- "rtc"
2889
- );
2890
- function onErrorCaptured(hook, target = currentInstance) {
2891
- injectHook("ec", hook, target);
2892
- }
2893
-
2894
- function renderList(source, renderItem, cache, index) {
2895
- let ret;
2896
- const cached = cache && cache[index];
2897
- if (shared.isArray(source) || shared.isString(source)) {
2898
- ret = new Array(source.length);
2899
- for (let i = 0, l = source.length; i < l; i++) {
2900
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
2901
- }
2902
- } else if (typeof source === "number") {
2903
- if (!Number.isInteger(source)) {
2904
- warn$1(`The v-for range expect an integer value but got ${source}.`);
2905
- }
2906
- ret = new Array(source);
2907
- for (let i = 0; i < source; i++) {
2908
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2909
- }
2910
- } else if (shared.isObject(source)) {
2911
- if (source[Symbol.iterator]) {
2912
- ret = Array.from(
2913
- source,
2914
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
2915
- );
2916
- } else {
2917
- const keys = Object.keys(source);
2918
- ret = new Array(keys.length);
2919
- for (let i = 0, l = keys.length; i < l; i++) {
2920
- const key = keys[i];
2921
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2922
- }
2923
- }
2924
- } else {
2925
- ret = [];
2926
- }
2927
- if (cache) {
2928
- cache[index] = ret;
2929
- }
2930
- return ret;
2931
- }
2932
-
2933
- function createSlots(slots, dynamicSlots) {
2934
- for (let i = 0; i < dynamicSlots.length; i++) {
2935
- const slot = dynamicSlots[i];
2936
- if (shared.isArray(slot)) {
2937
- for (let j = 0; j < slot.length; j++) {
2938
- slots[slot[j].name] = slot[j].fn;
2939
- }
2940
- } else if (slot) {
2941
- slots[slot.name] = slot.key ? (...args) => {
2942
- const res = slot.fn(...args);
2943
- if (res)
2944
- res.key = slot.key;
2945
- return res;
2946
- } : slot.fn;
2947
- }
2948
- }
2949
- return slots;
2950
- }
2951
-
2952
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2953
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2954
- if (name !== "default")
2955
- props.name = name;
2956
- return createVNode("slot", props, fallback && fallback());
2957
- }
2958
- let slot = slots[name];
2959
- if (slot && slot.length > 1) {
2960
- warn$1(
2961
- `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.`
2962
- );
2963
- slot = () => [];
2964
- }
2965
- if (slot && slot._c) {
2966
- slot._d = false;
2967
- }
2968
- openBlock();
2969
- const validSlotContent = slot && ensureValidVNode(slot(props));
2970
- const rendered = createBlock(
2971
- Fragment,
2972
- {
2973
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
2974
- // key attached in the `createSlots` helper, respect that
2975
- validSlotContent && validSlotContent.key || `_${name}`
2976
- },
2977
- validSlotContent || (fallback ? fallback() : []),
2978
- validSlotContent && slots._ === 1 ? 64 : -2
2979
- );
2980
- if (!noSlotted && rendered.scopeId) {
2981
- rendered.slotScopeIds = [rendered.scopeId + "-s"];
2982
- }
2983
- if (slot && slot._c) {
2984
- slot._d = true;
2985
- }
2986
- return rendered;
2987
- }
2988
- function ensureValidVNode(vnodes) {
2989
- return vnodes.some((child) => {
2990
- if (!isVNode(child))
2991
- return true;
2992
- if (child.type === Comment)
2993
- return false;
2994
- if (child.type === Fragment && !ensureValidVNode(child.children))
2995
- return false;
2996
- return true;
2997
- }) ? vnodes : null;
2998
- }
2999
-
3000
- function toHandlers(obj, preserveCaseIfNecessary) {
3001
- const ret = {};
3002
- if (!shared.isObject(obj)) {
3003
- warn$1(`v-on with no argument expects an object value.`);
3004
- return ret;
3005
- }
3006
- for (const key in obj) {
3007
- ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
3008
- }
3009
- return ret;
2136
+
2137
+ function toHandlers(obj, preserveCaseIfNecessary) {
2138
+ const ret = {};
2139
+ if (!shared.isObject(obj)) {
2140
+ warn$1(`v-on with no argument expects an object value.`);
2141
+ return ret;
2142
+ }
2143
+ for (const key in obj) {
2144
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
2145
+ }
2146
+ return ret;
3010
2147
  }
3011
2148
 
3012
2149
  const getPublicInstance = (i) => {
3013
- if (!i)
3014
- return null;
3015
- if (isStatefulComponent(i))
3016
- return getExposeProxy(i) || i.proxy;
2150
+ if (!i) return null;
2151
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
3017
2152
  return getPublicInstance(i.parent);
3018
2153
  };
3019
2154
  const publicPropertiesMap = (
@@ -3325,8 +2460,7 @@ function normalizePropsOrEmits(props) {
3325
2460
  function mergeDefaults(raw, defaults) {
3326
2461
  const props = normalizePropsOrEmits(raw);
3327
2462
  for (const key in defaults) {
3328
- if (key.startsWith("__skip"))
3329
- continue;
2463
+ if (key.startsWith("__skip")) continue;
3330
2464
  let opt = props[key];
3331
2465
  if (opt) {
3332
2466
  if (shared.isArray(opt) || shared.isFunction(opt)) {
@@ -3346,10 +2480,8 @@ function mergeDefaults(raw, defaults) {
3346
2480
  return props;
3347
2481
  }
3348
2482
  function mergeModels(a, b) {
3349
- if (!a || !b)
3350
- return a || b;
3351
- if (shared.isArray(a) && shared.isArray(b))
3352
- return a.concat(b);
2483
+ if (!a || !b) return a || b;
2484
+ if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
3353
2485
  return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
3354
2486
  }
3355
2487
  function createPropsRestProxy(props, excludedKeys) {
@@ -3579,10 +2711,8 @@ function applyOptions(instance) {
3579
2711
  if (inheritAttrs != null) {
3580
2712
  instance.inheritAttrs = inheritAttrs;
3581
2713
  }
3582
- if (components)
3583
- instance.components = components;
3584
- if (directives)
3585
- instance.directives = directives;
2714
+ if (components) instance.components = components;
2715
+ if (directives) instance.directives = directives;
3586
2716
  }
3587
2717
  function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
3588
2718
  if (shared.isArray(injectOptions)) {
@@ -3783,10 +2913,8 @@ function mergeEmitsOrPropsOptions(to, from) {
3783
2913
  }
3784
2914
  }
3785
2915
  function mergeWatchOptions(to, from) {
3786
- if (!to)
3787
- return from;
3788
- if (!from)
3789
- return to;
2916
+ if (!to) return from;
2917
+ if (!from) return to;
3790
2918
  const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
3791
2919
  for (const key in from) {
3792
2920
  merged[key] = mergeAsArray(to[key], from[key]);
@@ -3936,7 +3064,7 @@ function createAppAPI(render, hydrate) {
3936
3064
  app._instance = vnode.component;
3937
3065
  devtoolsInitApp(app, version);
3938
3066
  }
3939
- return getExposeProxy(vnode.component) || vnode.component.proxy;
3067
+ return getComponentPublicInstance(vnode.component);
3940
3068
  } else {
3941
3069
  warn$1(
3942
3070
  `App has already been mounted.
@@ -4043,8 +3171,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
4043
3171
  }
4044
3172
  function isInHmrContext(instance) {
4045
3173
  while (instance) {
4046
- if (instance.type.__hmrId)
4047
- return true;
3174
+ if (instance.type.__hmrId) return true;
4048
3175
  instance = instance.parent;
4049
3176
  }
4050
3177
  }
@@ -4229,8 +3356,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4229
3356
  hasExtends = true;
4230
3357
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
4231
3358
  shared.extend(normalized, props);
4232
- if (keys)
4233
- needCastKeys.push(...keys);
3359
+ if (keys) needCastKeys.push(...keys);
4234
3360
  };
4235
3361
  if (!asMixin && appContext.mixins.length) {
4236
3362
  appContext.mixins.forEach(extendProps);
@@ -4321,8 +3447,7 @@ function validateProps(rawProps, props, instance) {
4321
3447
  const options = instance.propsOptions[0];
4322
3448
  for (const key in options) {
4323
3449
  let opt = options[key];
4324
- if (opt == null)
4325
- continue;
3450
+ if (opt == null) continue;
4326
3451
  validateProp(
4327
3452
  key,
4328
3453
  resolvedValues[key],
@@ -4440,8 +3565,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4440
3565
  const normalizeObjectSlots = (rawSlots, slots, instance) => {
4441
3566
  const ctx = rawSlots._ctx;
4442
3567
  for (const key in rawSlots) {
4443
- if (isInternalKey(key))
4444
- continue;
3568
+ if (isInternalKey(key)) continue;
4445
3569
  const value = rawSlots[key];
4446
3570
  if (shared.isFunction(value)) {
4447
3571
  slots[key] = normalizeSlot(key, value, ctx);
@@ -4531,7 +3655,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4531
3655
  if (isAsyncWrapper(vnode) && !isUnmount) {
4532
3656
  return;
4533
3657
  }
4534
- const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
3658
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
4535
3659
  const value = isUnmount ? null : refValue;
4536
3660
  const { i: owner, r: ref } = rawRef;
4537
3661
  if (!owner) {
@@ -4573,8 +3697,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4573
3697
  }
4574
3698
  } else {
4575
3699
  ref.value = [refValue];
4576
- if (rawRef.k)
4577
- refs[rawRef.k] = ref.value;
3700
+ if (rawRef.k) refs[rawRef.k] = ref.value;
4578
3701
  }
4579
3702
  } else if (!existing.includes(refValue)) {
4580
3703
  existing.push(refValue);
@@ -4587,8 +3710,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4587
3710
  }
4588
3711
  } else if (_isRef) {
4589
3712
  ref.value = value;
4590
- if (rawRef.k)
4591
- refs[rawRef.k] = value;
3713
+ if (rawRef.k) refs[rawRef.k] = value;
4592
3714
  } else {
4593
3715
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4594
3716
  }
@@ -4605,14 +3727,19 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4605
3727
  }
4606
3728
  }
4607
3729
 
4608
- let hasMismatch = false;
3730
+ let hasLoggedMismatchError = false;
3731
+ const logMismatchError = () => {
3732
+ if (hasLoggedMismatchError) {
3733
+ return;
3734
+ }
3735
+ console.error("Hydration completed but contains mismatches.");
3736
+ hasLoggedMismatchError = true;
3737
+ };
4609
3738
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4610
3739
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4611
3740
  const getContainerType = (container) => {
4612
- if (isSVGContainer(container))
4613
- return "svg";
4614
- if (isMathMLContainer(container))
4615
- return "mathml";
3741
+ if (isSVGContainer(container)) return "svg";
3742
+ if (isMathMLContainer(container)) return "mathml";
4616
3743
  return void 0;
4617
3744
  };
4618
3745
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -4640,13 +3767,9 @@ function createHydrationFunctions(rendererInternals) {
4640
3767
  container._vnode = vnode;
4641
3768
  return;
4642
3769
  }
4643
- hasMismatch = false;
4644
3770
  hydrateNode(container.firstChild, vnode, null, null, null);
4645
3771
  flushPostFlushCbs();
4646
3772
  container._vnode = vnode;
4647
- if (hasMismatch && true) {
4648
- console.error(`Hydration completed but contains mismatches.`);
4649
- }
4650
3773
  };
4651
3774
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
4652
3775
  optimized = optimized || !!vnode.dynamicChildren;
@@ -4692,7 +3815,6 @@ function createHydrationFunctions(rendererInternals) {
4692
3815
  }
4693
3816
  } else {
4694
3817
  if (node.data !== vnode.children) {
4695
- hasMismatch = true;
4696
3818
  warn$1(
4697
3819
  `Hydration text mismatch in`,
4698
3820
  node.parentNode,
@@ -4702,6 +3824,7 @@ function createHydrationFunctions(rendererInternals) {
4702
3824
  )}
4703
3825
  - expected on client: ${JSON.stringify(vnode.children)}`
4704
3826
  );
3827
+ logMismatchError();
4705
3828
  node.data = vnode.children;
4706
3829
  }
4707
3830
  nextNode = nextSibling(node);
@@ -4867,7 +3990,6 @@ function createHydrationFunctions(rendererInternals) {
4867
3990
  );
4868
3991
  let hasWarned = false;
4869
3992
  while (next) {
4870
- hasMismatch = true;
4871
3993
  if (!hasWarned) {
4872
3994
  warn$1(
4873
3995
  `Hydration children mismatch on`,
@@ -4877,13 +3999,13 @@ Server rendered element contains more child nodes than client vdom.`
4877
3999
  );
4878
4000
  hasWarned = true;
4879
4001
  }
4002
+ logMismatchError();
4880
4003
  const cur = next;
4881
4004
  next = next.nextSibling;
4882
4005
  remove(cur);
4883
4006
  }
4884
4007
  } else if (shapeFlag & 8) {
4885
4008
  if (el.textContent !== vnode.children) {
4886
- hasMismatch = true;
4887
4009
  warn$1(
4888
4010
  `Hydration text content mismatch on`,
4889
4011
  el,
@@ -4891,6 +4013,7 @@ Server rendered element contains more child nodes than client vdom.`
4891
4013
  - rendered on server: ${el.textContent}
4892
4014
  - expected on client: ${vnode.children}`
4893
4015
  );
4016
+ logMismatchError();
4894
4017
  el.textContent = vnode.children;
4895
4018
  }
4896
4019
  }
@@ -4898,7 +4021,7 @@ Server rendered element contains more child nodes than client vdom.`
4898
4021
  {
4899
4022
  for (const key in props) {
4900
4023
  if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
4901
- hasMismatch = true;
4024
+ logMismatchError();
4902
4025
  }
4903
4026
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4904
4027
  key[0] === ".") {
@@ -4949,9 +4072,8 @@ Server rendered element contains more child nodes than client vdom.`
4949
4072
  optimized
4950
4073
  );
4951
4074
  } else if (vnode.type === Text && !vnode.children) {
4952
- continue;
4075
+ insert(vnode.el = createText(""), container);
4953
4076
  } else {
4954
- hasMismatch = true;
4955
4077
  if (!hasWarned) {
4956
4078
  warn$1(
4957
4079
  `Hydration children mismatch on`,
@@ -4961,6 +4083,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4961
4083
  );
4962
4084
  hasWarned = true;
4963
4085
  }
4086
+ logMismatchError();
4964
4087
  patch(
4965
4088
  null,
4966
4089
  vnode,
@@ -4993,13 +4116,12 @@ Server rendered element contains fewer child nodes than client vdom.`
4993
4116
  if (next && isComment(next) && next.data === "]") {
4994
4117
  return nextSibling(vnode.anchor = next);
4995
4118
  } else {
4996
- hasMismatch = true;
4119
+ logMismatchError();
4997
4120
  insert(vnode.anchor = createComment(`]`), container, next);
4998
4121
  return next;
4999
4122
  }
5000
4123
  };
5001
4124
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5002
- hasMismatch = true;
5003
4125
  warn$1(
5004
4126
  `Hydration node mismatch:
5005
4127
  - rendered on server:`,
@@ -5009,6 +4131,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5009
4131
  - expected on client:`,
5010
4132
  vnode.type
5011
4133
  );
4134
+ logMismatchError();
5012
4135
  vnode.el = null;
5013
4136
  if (isFragment) {
5014
4137
  const end = locateClosingAnchor(node);
@@ -5041,8 +4164,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5041
4164
  while (node) {
5042
4165
  node = nextSibling(node);
5043
4166
  if (node && isComment(node)) {
5044
- if (node.data === open)
5045
- match++;
4167
+ if (node.data === open) match++;
5046
4168
  if (node.data === close) {
5047
4169
  if (match === 0) {
5048
4170
  return nextSibling(node);
@@ -5097,7 +4219,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5097
4219
  }
5098
4220
  }
5099
4221
  const root = instance == null ? void 0 : instance.subTree;
5100
- if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
4222
+ if (vnode === root || // eslint-disable-next-line no-restricted-syntax
4223
+ (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
5101
4224
  const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
5102
4225
  for (const key2 in cssVars) {
5103
4226
  expectedMap.set(`--${key2}`, String(cssVars[key2]));
@@ -5726,8 +4849,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5726
4849
  }
5727
4850
  }
5728
4851
  for (const key in newProps) {
5729
- if (shared.isReservedProp(key))
5730
- continue;
4852
+ if (shared.isReservedProp(key)) continue;
5731
4853
  const next = newProps[key];
5732
4854
  const prev = oldProps[key];
5733
4855
  if (next !== prev && key !== "value") {
@@ -5864,7 +4986,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5864
4986
  }
5865
4987
  }
5866
4988
  if (instance.asyncDep) {
5867
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
4989
+ parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
5868
4990
  if (!initialVNode.el) {
5869
4991
  const placeholder = instance.subTree = createVNode(Comment);
5870
4992
  processCommentNode(null, placeholder, container, anchor);
@@ -6081,663 +5203,1552 @@ function baseCreateRenderer(options, createHydrationFns) {
6081
5203
  {
6082
5204
  popWarningContext();
6083
5205
  }
6084
- }
5206
+ }
5207
+ };
5208
+ const effect = instance.effect = new reactivity.ReactiveEffect(
5209
+ componentUpdateFn,
5210
+ shared.NOOP,
5211
+ () => queueJob(update),
5212
+ instance.scope
5213
+ // track it in component's effect scope
5214
+ );
5215
+ const update = instance.update = () => {
5216
+ if (effect.dirty) {
5217
+ effect.run();
5218
+ }
5219
+ };
5220
+ update.id = instance.uid;
5221
+ toggleRecurse(instance, true);
5222
+ {
5223
+ effect.onTrack = instance.rtc ? (e) => shared.invokeArrayFns(instance.rtc, e) : void 0;
5224
+ effect.onTrigger = instance.rtg ? (e) => shared.invokeArrayFns(instance.rtg, e) : void 0;
5225
+ update.ownerInstance = instance;
5226
+ }
5227
+ update();
5228
+ };
5229
+ const updateComponentPreRender = (instance, nextVNode, optimized) => {
5230
+ nextVNode.component = instance;
5231
+ const prevProps = instance.vnode.props;
5232
+ instance.vnode = nextVNode;
5233
+ instance.next = null;
5234
+ updateProps(instance, nextVNode.props, prevProps, optimized);
5235
+ updateSlots(instance, nextVNode.children, optimized);
5236
+ reactivity.pauseTracking();
5237
+ flushPreFlushCbs(instance);
5238
+ reactivity.resetTracking();
5239
+ };
5240
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5241
+ const c1 = n1 && n1.children;
5242
+ const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5243
+ const c2 = n2.children;
5244
+ const { patchFlag, shapeFlag } = n2;
5245
+ if (patchFlag > 0) {
5246
+ if (patchFlag & 128) {
5247
+ patchKeyedChildren(
5248
+ c1,
5249
+ c2,
5250
+ container,
5251
+ anchor,
5252
+ parentComponent,
5253
+ parentSuspense,
5254
+ namespace,
5255
+ slotScopeIds,
5256
+ optimized
5257
+ );
5258
+ return;
5259
+ } else if (patchFlag & 256) {
5260
+ patchUnkeyedChildren(
5261
+ c1,
5262
+ c2,
5263
+ container,
5264
+ anchor,
5265
+ parentComponent,
5266
+ parentSuspense,
5267
+ namespace,
5268
+ slotScopeIds,
5269
+ optimized
5270
+ );
5271
+ return;
5272
+ }
5273
+ }
5274
+ if (shapeFlag & 8) {
5275
+ if (prevShapeFlag & 16) {
5276
+ unmountChildren(c1, parentComponent, parentSuspense);
5277
+ }
5278
+ if (c2 !== c1) {
5279
+ hostSetElementText(container, c2);
5280
+ }
5281
+ } else {
5282
+ if (prevShapeFlag & 16) {
5283
+ if (shapeFlag & 16) {
5284
+ patchKeyedChildren(
5285
+ c1,
5286
+ c2,
5287
+ container,
5288
+ anchor,
5289
+ parentComponent,
5290
+ parentSuspense,
5291
+ namespace,
5292
+ slotScopeIds,
5293
+ optimized
5294
+ );
5295
+ } else {
5296
+ unmountChildren(c1, parentComponent, parentSuspense, true);
5297
+ }
5298
+ } else {
5299
+ if (prevShapeFlag & 8) {
5300
+ hostSetElementText(container, "");
5301
+ }
5302
+ if (shapeFlag & 16) {
5303
+ mountChildren(
5304
+ c2,
5305
+ container,
5306
+ anchor,
5307
+ parentComponent,
5308
+ parentSuspense,
5309
+ namespace,
5310
+ slotScopeIds,
5311
+ optimized
5312
+ );
5313
+ }
5314
+ }
5315
+ }
5316
+ };
5317
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5318
+ c1 = c1 || shared.EMPTY_ARR;
5319
+ c2 = c2 || shared.EMPTY_ARR;
5320
+ const oldLength = c1.length;
5321
+ const newLength = c2.length;
5322
+ const commonLength = Math.min(oldLength, newLength);
5323
+ let i;
5324
+ for (i = 0; i < commonLength; i++) {
5325
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5326
+ patch(
5327
+ c1[i],
5328
+ nextChild,
5329
+ container,
5330
+ null,
5331
+ parentComponent,
5332
+ parentSuspense,
5333
+ namespace,
5334
+ slotScopeIds,
5335
+ optimized
5336
+ );
5337
+ }
5338
+ if (oldLength > newLength) {
5339
+ unmountChildren(
5340
+ c1,
5341
+ parentComponent,
5342
+ parentSuspense,
5343
+ true,
5344
+ false,
5345
+ commonLength
5346
+ );
5347
+ } else {
5348
+ mountChildren(
5349
+ c2,
5350
+ container,
5351
+ anchor,
5352
+ parentComponent,
5353
+ parentSuspense,
5354
+ namespace,
5355
+ slotScopeIds,
5356
+ optimized,
5357
+ commonLength
5358
+ );
5359
+ }
5360
+ };
5361
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5362
+ let i = 0;
5363
+ const l2 = c2.length;
5364
+ let e1 = c1.length - 1;
5365
+ let e2 = l2 - 1;
5366
+ while (i <= e1 && i <= e2) {
5367
+ const n1 = c1[i];
5368
+ const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5369
+ if (isSameVNodeType(n1, n2)) {
5370
+ patch(
5371
+ n1,
5372
+ n2,
5373
+ container,
5374
+ null,
5375
+ parentComponent,
5376
+ parentSuspense,
5377
+ namespace,
5378
+ slotScopeIds,
5379
+ optimized
5380
+ );
5381
+ } else {
5382
+ break;
5383
+ }
5384
+ i++;
5385
+ }
5386
+ while (i <= e1 && i <= e2) {
5387
+ const n1 = c1[e1];
5388
+ const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
5389
+ if (isSameVNodeType(n1, n2)) {
5390
+ patch(
5391
+ n1,
5392
+ n2,
5393
+ container,
5394
+ null,
5395
+ parentComponent,
5396
+ parentSuspense,
5397
+ namespace,
5398
+ slotScopeIds,
5399
+ optimized
5400
+ );
5401
+ } else {
5402
+ break;
5403
+ }
5404
+ e1--;
5405
+ e2--;
5406
+ }
5407
+ if (i > e1) {
5408
+ if (i <= e2) {
5409
+ const nextPos = e2 + 1;
5410
+ const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
5411
+ while (i <= e2) {
5412
+ patch(
5413
+ null,
5414
+ c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
5415
+ container,
5416
+ anchor,
5417
+ parentComponent,
5418
+ parentSuspense,
5419
+ namespace,
5420
+ slotScopeIds,
5421
+ optimized
5422
+ );
5423
+ i++;
5424
+ }
5425
+ }
5426
+ } else if (i > e2) {
5427
+ while (i <= e1) {
5428
+ unmount(c1[i], parentComponent, parentSuspense, true);
5429
+ i++;
5430
+ }
5431
+ } else {
5432
+ const s1 = i;
5433
+ const s2 = i;
5434
+ const keyToNewIndexMap = /* @__PURE__ */ new Map();
5435
+ for (i = s2; i <= e2; i++) {
5436
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5437
+ if (nextChild.key != null) {
5438
+ if (keyToNewIndexMap.has(nextChild.key)) {
5439
+ warn$1(
5440
+ `Duplicate keys found during update:`,
5441
+ JSON.stringify(nextChild.key),
5442
+ `Make sure keys are unique.`
5443
+ );
5444
+ }
5445
+ keyToNewIndexMap.set(nextChild.key, i);
5446
+ }
5447
+ }
5448
+ let j;
5449
+ let patched = 0;
5450
+ const toBePatched = e2 - s2 + 1;
5451
+ let moved = false;
5452
+ let maxNewIndexSoFar = 0;
5453
+ const newIndexToOldIndexMap = new Array(toBePatched);
5454
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
5455
+ for (i = s1; i <= e1; i++) {
5456
+ const prevChild = c1[i];
5457
+ if (patched >= toBePatched) {
5458
+ unmount(prevChild, parentComponent, parentSuspense, true);
5459
+ continue;
5460
+ }
5461
+ let newIndex;
5462
+ if (prevChild.key != null) {
5463
+ newIndex = keyToNewIndexMap.get(prevChild.key);
5464
+ } else {
5465
+ for (j = s2; j <= e2; j++) {
5466
+ if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
5467
+ newIndex = j;
5468
+ break;
5469
+ }
5470
+ }
5471
+ }
5472
+ if (newIndex === void 0) {
5473
+ unmount(prevChild, parentComponent, parentSuspense, true);
5474
+ } else {
5475
+ newIndexToOldIndexMap[newIndex - s2] = i + 1;
5476
+ if (newIndex >= maxNewIndexSoFar) {
5477
+ maxNewIndexSoFar = newIndex;
5478
+ } else {
5479
+ moved = true;
5480
+ }
5481
+ patch(
5482
+ prevChild,
5483
+ c2[newIndex],
5484
+ container,
5485
+ null,
5486
+ parentComponent,
5487
+ parentSuspense,
5488
+ namespace,
5489
+ slotScopeIds,
5490
+ optimized
5491
+ );
5492
+ patched++;
5493
+ }
5494
+ }
5495
+ const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
5496
+ j = increasingNewIndexSequence.length - 1;
5497
+ for (i = toBePatched - 1; i >= 0; i--) {
5498
+ const nextIndex = s2 + i;
5499
+ const nextChild = c2[nextIndex];
5500
+ const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
5501
+ if (newIndexToOldIndexMap[i] === 0) {
5502
+ patch(
5503
+ null,
5504
+ nextChild,
5505
+ container,
5506
+ anchor,
5507
+ parentComponent,
5508
+ parentSuspense,
5509
+ namespace,
5510
+ slotScopeIds,
5511
+ optimized
5512
+ );
5513
+ } else if (moved) {
5514
+ if (j < 0 || i !== increasingNewIndexSequence[j]) {
5515
+ move(nextChild, container, anchor, 2);
5516
+ } else {
5517
+ j--;
5518
+ }
5519
+ }
5520
+ }
5521
+ }
5522
+ };
5523
+ const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5524
+ const { el, type, transition, children, shapeFlag } = vnode;
5525
+ if (shapeFlag & 6) {
5526
+ move(vnode.component.subTree, container, anchor, moveType);
5527
+ return;
5528
+ }
5529
+ if (shapeFlag & 128) {
5530
+ vnode.suspense.move(container, anchor, moveType);
5531
+ return;
5532
+ }
5533
+ if (shapeFlag & 64) {
5534
+ type.move(vnode, container, anchor, internals);
5535
+ return;
5536
+ }
5537
+ if (type === Fragment) {
5538
+ hostInsert(el, container, anchor);
5539
+ for (let i = 0; i < children.length; i++) {
5540
+ move(children[i], container, anchor, moveType);
5541
+ }
5542
+ hostInsert(vnode.anchor, container, anchor);
5543
+ return;
5544
+ }
5545
+ if (type === Static) {
5546
+ moveStaticNode(vnode, container, anchor);
5547
+ return;
5548
+ }
5549
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5550
+ if (needTransition2) {
5551
+ if (moveType === 0) {
5552
+ transition.beforeEnter(el);
5553
+ hostInsert(el, container, anchor);
5554
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5555
+ } else {
5556
+ const { leave, delayLeave, afterLeave } = transition;
5557
+ const remove2 = () => hostInsert(el, container, anchor);
5558
+ const performLeave = () => {
5559
+ leave(el, () => {
5560
+ remove2();
5561
+ afterLeave && afterLeave();
5562
+ });
5563
+ };
5564
+ if (delayLeave) {
5565
+ delayLeave(el, remove2, performLeave);
5566
+ } else {
5567
+ performLeave();
5568
+ }
5569
+ }
5570
+ } else {
5571
+ hostInsert(el, container, anchor);
5572
+ }
5573
+ };
5574
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5575
+ const {
5576
+ type,
5577
+ props,
5578
+ ref,
5579
+ children,
5580
+ dynamicChildren,
5581
+ shapeFlag,
5582
+ patchFlag,
5583
+ dirs,
5584
+ memoIndex
5585
+ } = vnode;
5586
+ if (ref != null) {
5587
+ setRef(ref, null, parentSuspense, vnode, true);
5588
+ }
5589
+ if (memoIndex != null) {
5590
+ parentComponent.renderCache[memoIndex] = void 0;
5591
+ }
5592
+ if (shapeFlag & 256) {
5593
+ parentComponent.ctx.deactivate(vnode);
5594
+ return;
5595
+ }
5596
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
5597
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
5598
+ let vnodeHook;
5599
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
5600
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
5601
+ }
5602
+ if (shapeFlag & 6) {
5603
+ unmountComponent(vnode.component, parentSuspense, doRemove);
5604
+ } else {
5605
+ if (shapeFlag & 128) {
5606
+ vnode.suspense.unmount(parentSuspense, doRemove);
5607
+ return;
5608
+ }
5609
+ if (shouldInvokeDirs) {
5610
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
5611
+ }
5612
+ if (shapeFlag & 64) {
5613
+ vnode.type.remove(
5614
+ vnode,
5615
+ parentComponent,
5616
+ parentSuspense,
5617
+ optimized,
5618
+ internals,
5619
+ doRemove
5620
+ );
5621
+ } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
5622
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5623
+ unmountChildren(
5624
+ dynamicChildren,
5625
+ parentComponent,
5626
+ parentSuspense,
5627
+ false,
5628
+ true
5629
+ );
5630
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5631
+ unmountChildren(children, parentComponent, parentSuspense);
5632
+ }
5633
+ if (doRemove) {
5634
+ remove(vnode);
5635
+ }
5636
+ }
5637
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5638
+ queuePostRenderEffect(() => {
5639
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5640
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5641
+ }, parentSuspense);
5642
+ }
5643
+ };
5644
+ const remove = (vnode) => {
5645
+ const { type, el, anchor, transition } = vnode;
5646
+ if (type === Fragment) {
5647
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
5648
+ vnode.children.forEach((child) => {
5649
+ if (child.type === Comment) {
5650
+ hostRemove(child.el);
5651
+ } else {
5652
+ remove(child);
5653
+ }
5654
+ });
5655
+ } else {
5656
+ removeFragment(el, anchor);
5657
+ }
5658
+ return;
5659
+ }
5660
+ if (type === Static) {
5661
+ removeStaticNode(vnode);
5662
+ return;
5663
+ }
5664
+ const performRemove = () => {
5665
+ hostRemove(el);
5666
+ if (transition && !transition.persisted && transition.afterLeave) {
5667
+ transition.afterLeave();
5668
+ }
5669
+ };
5670
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
5671
+ const { leave, delayLeave } = transition;
5672
+ const performLeave = () => leave(el, performRemove);
5673
+ if (delayLeave) {
5674
+ delayLeave(vnode.el, performRemove, performLeave);
5675
+ } else {
5676
+ performLeave();
5677
+ }
5678
+ } else {
5679
+ performRemove();
5680
+ }
5681
+ };
5682
+ const removeFragment = (cur, end) => {
5683
+ let next;
5684
+ while (cur !== end) {
5685
+ next = hostNextSibling(cur);
5686
+ hostRemove(cur);
5687
+ cur = next;
5688
+ }
5689
+ hostRemove(end);
5690
+ };
5691
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
5692
+ if (instance.type.__hmrId) {
5693
+ unregisterHMR(instance);
5694
+ }
5695
+ const { bum, scope, update, subTree, um, m, a } = instance;
5696
+ invalidateMount(m);
5697
+ invalidateMount(a);
5698
+ if (bum) {
5699
+ shared.invokeArrayFns(bum);
5700
+ }
5701
+ scope.stop();
5702
+ if (update) {
5703
+ update.active = false;
5704
+ unmount(subTree, instance, parentSuspense, doRemove);
5705
+ }
5706
+ if (um) {
5707
+ queuePostRenderEffect(um, parentSuspense);
5708
+ }
5709
+ queuePostRenderEffect(() => {
5710
+ instance.isUnmounted = true;
5711
+ }, parentSuspense);
5712
+ if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5713
+ parentSuspense.deps--;
5714
+ if (parentSuspense.deps === 0) {
5715
+ parentSuspense.resolve();
5716
+ }
5717
+ }
5718
+ {
5719
+ devtoolsComponentRemoved(instance);
5720
+ }
5721
+ };
5722
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
5723
+ for (let i = start; i < children.length; i++) {
5724
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
5725
+ }
5726
+ };
5727
+ const getNextHostNode = (vnode) => {
5728
+ if (vnode.shapeFlag & 6) {
5729
+ return getNextHostNode(vnode.component.subTree);
5730
+ }
5731
+ if (vnode.shapeFlag & 128) {
5732
+ return vnode.suspense.next();
5733
+ }
5734
+ return hostNextSibling(vnode.anchor || vnode.el);
5735
+ };
5736
+ let isFlushing = false;
5737
+ const render = (vnode, container, namespace) => {
5738
+ if (vnode == null) {
5739
+ if (container._vnode) {
5740
+ unmount(container._vnode, null, null, true);
5741
+ }
5742
+ } else {
5743
+ patch(
5744
+ container._vnode || null,
5745
+ vnode,
5746
+ container,
5747
+ null,
5748
+ null,
5749
+ null,
5750
+ namespace
5751
+ );
5752
+ }
5753
+ if (!isFlushing) {
5754
+ isFlushing = true;
5755
+ flushPreFlushCbs();
5756
+ flushPostFlushCbs();
5757
+ isFlushing = false;
5758
+ }
5759
+ container._vnode = vnode;
5760
+ };
5761
+ const internals = {
5762
+ p: patch,
5763
+ um: unmount,
5764
+ m: move,
5765
+ r: remove,
5766
+ mt: mountComponent,
5767
+ mc: mountChildren,
5768
+ pc: patchChildren,
5769
+ pbc: patchBlockChildren,
5770
+ n: getNextHostNode,
5771
+ o: options
5772
+ };
5773
+ let hydrate;
5774
+ let hydrateNode;
5775
+ if (createHydrationFns) {
5776
+ [hydrate, hydrateNode] = createHydrationFns(
5777
+ internals
5778
+ );
5779
+ }
5780
+ return {
5781
+ render,
5782
+ hydrate,
5783
+ createApp: createAppAPI(render, hydrate)
5784
+ };
5785
+ }
5786
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
5787
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5788
+ }
5789
+ function toggleRecurse({ effect, update }, allowed) {
5790
+ effect.allowRecurse = update.allowRecurse = allowed;
5791
+ }
5792
+ function needTransition(parentSuspense, transition) {
5793
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
5794
+ }
5795
+ function traverseStaticChildren(n1, n2, shallow = false) {
5796
+ const ch1 = n1.children;
5797
+ const ch2 = n2.children;
5798
+ if (shared.isArray(ch1) && shared.isArray(ch2)) {
5799
+ for (let i = 0; i < ch1.length; i++) {
5800
+ const c1 = ch1[i];
5801
+ let c2 = ch2[i];
5802
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
5803
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
5804
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
5805
+ c2.el = c1.el;
5806
+ }
5807
+ if (!shallow && c2.patchFlag !== -2)
5808
+ traverseStaticChildren(c1, c2);
5809
+ }
5810
+ if (c2.type === Text) {
5811
+ c2.el = c1.el;
5812
+ }
5813
+ if (c2.type === Comment && !c2.el) {
5814
+ c2.el = c1.el;
5815
+ }
5816
+ }
5817
+ }
5818
+ }
5819
+ function getSequence(arr) {
5820
+ const p = arr.slice();
5821
+ const result = [0];
5822
+ let i, j, u, v, c;
5823
+ const len = arr.length;
5824
+ for (i = 0; i < len; i++) {
5825
+ const arrI = arr[i];
5826
+ if (arrI !== 0) {
5827
+ j = result[result.length - 1];
5828
+ if (arr[j] < arrI) {
5829
+ p[i] = j;
5830
+ result.push(i);
5831
+ continue;
5832
+ }
5833
+ u = 0;
5834
+ v = result.length - 1;
5835
+ while (u < v) {
5836
+ c = u + v >> 1;
5837
+ if (arr[result[c]] < arrI) {
5838
+ u = c + 1;
5839
+ } else {
5840
+ v = c;
5841
+ }
5842
+ }
5843
+ if (arrI < arr[result[u]]) {
5844
+ if (u > 0) {
5845
+ p[i] = result[u - 1];
5846
+ }
5847
+ result[u] = i;
5848
+ }
5849
+ }
5850
+ }
5851
+ u = result.length;
5852
+ v = result[u - 1];
5853
+ while (u-- > 0) {
5854
+ result[u] = v;
5855
+ v = p[v];
5856
+ }
5857
+ return result;
5858
+ }
5859
+ function locateNonHydratedAsyncRoot(instance) {
5860
+ const subComponent = instance.subTree.component;
5861
+ if (subComponent) {
5862
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
5863
+ return subComponent;
5864
+ } else {
5865
+ return locateNonHydratedAsyncRoot(subComponent);
5866
+ }
5867
+ }
5868
+ }
5869
+ function invalidateMount(hooks) {
5870
+ if (hooks) {
5871
+ for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
5872
+ }
5873
+ }
5874
+
5875
+ const ssrContextKey = Symbol.for("v-scx");
5876
+ const useSSRContext = () => {
5877
+ {
5878
+ const ctx = inject(ssrContextKey);
5879
+ if (!ctx) {
5880
+ warn$1(
5881
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
5882
+ );
5883
+ }
5884
+ return ctx;
5885
+ }
5886
+ };
5887
+
5888
+ function watchEffect(effect, options) {
5889
+ return doWatch(effect, null, options);
5890
+ }
5891
+ function watchPostEffect(effect, options) {
5892
+ return doWatch(
5893
+ effect,
5894
+ null,
5895
+ shared.extend({}, options, { flush: "post" })
5896
+ );
5897
+ }
5898
+ function watchSyncEffect(effect, options) {
5899
+ return doWatch(
5900
+ effect,
5901
+ null,
5902
+ shared.extend({}, options, { flush: "sync" })
5903
+ );
5904
+ }
5905
+ const INITIAL_WATCHER_VALUE = {};
5906
+ function watch(source, cb, options) {
5907
+ if (!shared.isFunction(cb)) {
5908
+ warn$1(
5909
+ `\`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.`
5910
+ );
5911
+ }
5912
+ return doWatch(source, cb, options);
5913
+ }
5914
+ function doWatch(source, cb, {
5915
+ immediate,
5916
+ deep,
5917
+ flush,
5918
+ once,
5919
+ onTrack,
5920
+ onTrigger
5921
+ } = shared.EMPTY_OBJ) {
5922
+ if (cb && once) {
5923
+ const _cb = cb;
5924
+ cb = (...args) => {
5925
+ _cb(...args);
5926
+ unwatch();
5927
+ };
5928
+ }
5929
+ if (deep !== void 0 && typeof deep === "number") {
5930
+ warn$1(
5931
+ `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
5932
+ );
5933
+ }
5934
+ if (!cb) {
5935
+ if (immediate !== void 0) {
5936
+ warn$1(
5937
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
5938
+ );
5939
+ }
5940
+ if (deep !== void 0) {
5941
+ warn$1(
5942
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
5943
+ );
5944
+ }
5945
+ if (once !== void 0) {
5946
+ warn$1(
5947
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
5948
+ );
5949
+ }
5950
+ }
5951
+ const warnInvalidSource = (s) => {
5952
+ warn$1(
5953
+ `Invalid watch source: `,
5954
+ s,
5955
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
5956
+ );
5957
+ };
5958
+ const instance = currentInstance;
5959
+ const reactiveGetter = (source2) => deep === true ? source2 : (
5960
+ // for deep: false, only traverse root-level properties
5961
+ traverse(source2, deep === false ? 1 : void 0)
5962
+ );
5963
+ let getter;
5964
+ let forceTrigger = false;
5965
+ let isMultiSource = false;
5966
+ if (reactivity.isRef(source)) {
5967
+ getter = () => source.value;
5968
+ forceTrigger = reactivity.isShallow(source);
5969
+ } else if (reactivity.isReactive(source)) {
5970
+ getter = () => reactiveGetter(source);
5971
+ forceTrigger = true;
5972
+ } else if (shared.isArray(source)) {
5973
+ isMultiSource = true;
5974
+ forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
5975
+ getter = () => source.map((s) => {
5976
+ if (reactivity.isRef(s)) {
5977
+ return s.value;
5978
+ } else if (reactivity.isReactive(s)) {
5979
+ return reactiveGetter(s);
5980
+ } else if (shared.isFunction(s)) {
5981
+ return callWithErrorHandling(s, instance, 2);
5982
+ } else {
5983
+ warnInvalidSource(s);
5984
+ }
5985
+ });
5986
+ } else if (shared.isFunction(source)) {
5987
+ if (cb) {
5988
+ getter = () => callWithErrorHandling(source, instance, 2);
5989
+ } else {
5990
+ getter = () => {
5991
+ if (cleanup) {
5992
+ cleanup();
5993
+ }
5994
+ return callWithAsyncErrorHandling(
5995
+ source,
5996
+ instance,
5997
+ 3,
5998
+ [onCleanup]
5999
+ );
6000
+ };
6001
+ }
6002
+ } else {
6003
+ getter = shared.NOOP;
6004
+ warnInvalidSource(source);
6005
+ }
6006
+ if (cb && deep) {
6007
+ const baseGetter = getter;
6008
+ getter = () => traverse(baseGetter());
6009
+ }
6010
+ let cleanup;
6011
+ let onCleanup = (fn) => {
6012
+ cleanup = effect.onStop = () => {
6013
+ callWithErrorHandling(fn, instance, 4);
6014
+ cleanup = effect.onStop = void 0;
6085
6015
  };
6086
- const effect = instance.effect = new reactivity.ReactiveEffect(
6087
- componentUpdateFn,
6088
- shared.NOOP,
6089
- () => queueJob(update),
6090
- instance.scope
6091
- // track it in component's effect scope
6092
- );
6093
- const update = instance.update = () => {
6094
- if (effect.dirty) {
6095
- effect.run();
6016
+ };
6017
+ let ssrCleanup;
6018
+ if (isInSSRComponentSetup) {
6019
+ onCleanup = shared.NOOP;
6020
+ if (!cb) {
6021
+ getter();
6022
+ } else if (immediate) {
6023
+ callWithAsyncErrorHandling(cb, instance, 3, [
6024
+ getter(),
6025
+ isMultiSource ? [] : void 0,
6026
+ onCleanup
6027
+ ]);
6028
+ }
6029
+ if (flush === "sync") {
6030
+ const ctx = useSSRContext();
6031
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
6032
+ } else {
6033
+ return shared.NOOP;
6034
+ }
6035
+ }
6036
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
6037
+ const job = () => {
6038
+ if (!effect.active || !effect.dirty) {
6039
+ return;
6040
+ }
6041
+ if (cb) {
6042
+ const newValue = effect.run();
6043
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
6044
+ if (cleanup) {
6045
+ cleanup();
6046
+ }
6047
+ callWithAsyncErrorHandling(cb, instance, 3, [
6048
+ newValue,
6049
+ // pass undefined as the old value when it's changed for the first time
6050
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
6051
+ onCleanup
6052
+ ]);
6053
+ oldValue = newValue;
6096
6054
  }
6097
- };
6098
- update.id = instance.uid;
6099
- toggleRecurse(instance, true);
6100
- {
6101
- effect.onTrack = instance.rtc ? (e) => shared.invokeArrayFns(instance.rtc, e) : void 0;
6102
- effect.onTrigger = instance.rtg ? (e) => shared.invokeArrayFns(instance.rtg, e) : void 0;
6103
- update.ownerInstance = instance;
6055
+ } else {
6056
+ effect.run();
6104
6057
  }
6105
- update();
6106
- };
6107
- const updateComponentPreRender = (instance, nextVNode, optimized) => {
6108
- nextVNode.component = instance;
6109
- const prevProps = instance.vnode.props;
6110
- instance.vnode = nextVNode;
6111
- instance.next = null;
6112
- updateProps(instance, nextVNode.props, prevProps, optimized);
6113
- updateSlots(instance, nextVNode.children, optimized);
6114
- reactivity.pauseTracking();
6115
- flushPreFlushCbs(instance);
6116
- reactivity.resetTracking();
6117
6058
  };
6118
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
6119
- const c1 = n1 && n1.children;
6120
- const prevShapeFlag = n1 ? n1.shapeFlag : 0;
6121
- const c2 = n2.children;
6122
- const { patchFlag, shapeFlag } = n2;
6123
- if (patchFlag > 0) {
6124
- if (patchFlag & 128) {
6125
- patchKeyedChildren(
6126
- c1,
6127
- c2,
6128
- container,
6129
- anchor,
6130
- parentComponent,
6131
- parentSuspense,
6132
- namespace,
6133
- slotScopeIds,
6134
- optimized
6135
- );
6136
- return;
6137
- } else if (patchFlag & 256) {
6138
- patchUnkeyedChildren(
6139
- c1,
6140
- c2,
6141
- container,
6142
- anchor,
6143
- parentComponent,
6144
- parentSuspense,
6145
- namespace,
6146
- slotScopeIds,
6147
- optimized
6148
- );
6149
- return;
6150
- }
6059
+ job.allowRecurse = !!cb;
6060
+ let scheduler;
6061
+ if (flush === "sync") {
6062
+ scheduler = job;
6063
+ } else if (flush === "post") {
6064
+ scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
6065
+ } else {
6066
+ job.pre = true;
6067
+ if (instance) job.id = instance.uid;
6068
+ scheduler = () => queueJob(job);
6069
+ }
6070
+ const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
6071
+ const scope = reactivity.getCurrentScope();
6072
+ const unwatch = () => {
6073
+ effect.stop();
6074
+ if (scope) {
6075
+ shared.remove(scope.effects, effect);
6151
6076
  }
6152
- if (shapeFlag & 8) {
6153
- if (prevShapeFlag & 16) {
6154
- unmountChildren(c1, parentComponent, parentSuspense);
6155
- }
6156
- if (c2 !== c1) {
6157
- hostSetElementText(container, c2);
6158
- }
6077
+ };
6078
+ {
6079
+ effect.onTrack = onTrack;
6080
+ effect.onTrigger = onTrigger;
6081
+ }
6082
+ if (cb) {
6083
+ if (immediate) {
6084
+ job();
6159
6085
  } else {
6160
- if (prevShapeFlag & 16) {
6161
- if (shapeFlag & 16) {
6162
- patchKeyedChildren(
6163
- c1,
6164
- c2,
6165
- container,
6166
- anchor,
6167
- parentComponent,
6168
- parentSuspense,
6169
- namespace,
6170
- slotScopeIds,
6171
- optimized
6172
- );
6173
- } else {
6174
- unmountChildren(c1, parentComponent, parentSuspense, true);
6175
- }
6176
- } else {
6177
- if (prevShapeFlag & 8) {
6178
- hostSetElementText(container, "");
6179
- }
6180
- if (shapeFlag & 16) {
6181
- mountChildren(
6182
- c2,
6183
- container,
6184
- anchor,
6185
- parentComponent,
6186
- parentSuspense,
6187
- namespace,
6188
- slotScopeIds,
6189
- optimized
6190
- );
6191
- }
6086
+ oldValue = effect.run();
6087
+ }
6088
+ } else if (flush === "post") {
6089
+ queuePostRenderEffect(
6090
+ effect.run.bind(effect),
6091
+ instance && instance.suspense
6092
+ );
6093
+ } else {
6094
+ effect.run();
6095
+ }
6096
+ if (ssrCleanup) ssrCleanup.push(unwatch);
6097
+ return unwatch;
6098
+ }
6099
+ function instanceWatch(source, value, options) {
6100
+ const publicThis = this.proxy;
6101
+ const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
6102
+ let cb;
6103
+ if (shared.isFunction(value)) {
6104
+ cb = value;
6105
+ } else {
6106
+ cb = value.handler;
6107
+ options = value;
6108
+ }
6109
+ const reset = setCurrentInstance(this);
6110
+ const res = doWatch(getter, cb.bind(publicThis), options);
6111
+ reset();
6112
+ return res;
6113
+ }
6114
+ function createPathGetter(ctx, path) {
6115
+ const segments = path.split(".");
6116
+ return () => {
6117
+ let cur = ctx;
6118
+ for (let i = 0; i < segments.length && cur; i++) {
6119
+ cur = cur[segments[i]];
6120
+ }
6121
+ return cur;
6122
+ };
6123
+ }
6124
+ function traverse(value, depth = Infinity, seen) {
6125
+ if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
6126
+ return value;
6127
+ }
6128
+ seen = seen || /* @__PURE__ */ new Set();
6129
+ if (seen.has(value)) {
6130
+ return value;
6131
+ }
6132
+ seen.add(value);
6133
+ depth--;
6134
+ if (reactivity.isRef(value)) {
6135
+ traverse(value.value, depth, seen);
6136
+ } else if (shared.isArray(value)) {
6137
+ for (let i = 0; i < value.length; i++) {
6138
+ traverse(value[i], depth, seen);
6139
+ }
6140
+ } else if (shared.isSet(value) || shared.isMap(value)) {
6141
+ value.forEach((v) => {
6142
+ traverse(v, depth, seen);
6143
+ });
6144
+ } else if (shared.isPlainObject(value)) {
6145
+ for (const key in value) {
6146
+ traverse(value[key], depth, seen);
6147
+ }
6148
+ for (const key of Object.getOwnPropertySymbols(value)) {
6149
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
6150
+ traverse(value[key], depth, seen);
6192
6151
  }
6193
6152
  }
6194
- };
6195
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6196
- c1 = c1 || shared.EMPTY_ARR;
6197
- c2 = c2 || shared.EMPTY_ARR;
6198
- const oldLength = c1.length;
6199
- const newLength = c2.length;
6200
- const commonLength = Math.min(oldLength, newLength);
6201
- let i;
6202
- for (i = 0; i < commonLength; i++) {
6203
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6204
- patch(
6205
- c1[i],
6206
- nextChild,
6207
- container,
6208
- null,
6209
- parentComponent,
6210
- parentSuspense,
6211
- namespace,
6212
- slotScopeIds,
6213
- optimized
6214
- );
6153
+ }
6154
+ return value;
6155
+ }
6156
+
6157
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
6158
+ const KeepAliveImpl = {
6159
+ name: `KeepAlive`,
6160
+ // Marker for special handling inside the renderer. We are not using a ===
6161
+ // check directly on KeepAlive in the renderer, because importing it directly
6162
+ // would prevent it from being tree-shaken.
6163
+ __isKeepAlive: true,
6164
+ props: {
6165
+ include: [String, RegExp, Array],
6166
+ exclude: [String, RegExp, Array],
6167
+ max: [String, Number]
6168
+ },
6169
+ setup(props, { slots }) {
6170
+ const instance = getCurrentInstance();
6171
+ const sharedContext = instance.ctx;
6172
+ if (!sharedContext.renderer) {
6173
+ return () => {
6174
+ const children = slots.default && slots.default();
6175
+ return children && children.length === 1 ? children[0] : children;
6176
+ };
6177
+ }
6178
+ const cache = /* @__PURE__ */ new Map();
6179
+ const keys = /* @__PURE__ */ new Set();
6180
+ let current = null;
6181
+ {
6182
+ instance.__v_cache = cache;
6215
6183
  }
6216
- if (oldLength > newLength) {
6217
- unmountChildren(
6218
- c1,
6219
- parentComponent,
6220
- parentSuspense,
6221
- true,
6222
- false,
6223
- commonLength
6224
- );
6225
- } else {
6226
- mountChildren(
6227
- c2,
6184
+ const parentSuspense = instance.suspense;
6185
+ const {
6186
+ renderer: {
6187
+ p: patch,
6188
+ m: move,
6189
+ um: _unmount,
6190
+ o: { createElement }
6191
+ }
6192
+ } = sharedContext;
6193
+ const storageContainer = createElement("div");
6194
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
6195
+ const instance2 = vnode.component;
6196
+ move(vnode, container, anchor, 0, parentSuspense);
6197
+ patch(
6198
+ instance2.vnode,
6199
+ vnode,
6228
6200
  container,
6229
6201
  anchor,
6230
- parentComponent,
6202
+ instance2,
6231
6203
  parentSuspense,
6232
6204
  namespace,
6233
- slotScopeIds,
6234
- optimized,
6235
- commonLength
6205
+ vnode.slotScopeIds,
6206
+ optimized
6236
6207
  );
6237
- }
6238
- };
6239
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6240
- let i = 0;
6241
- const l2 = c2.length;
6242
- let e1 = c1.length - 1;
6243
- let e2 = l2 - 1;
6244
- while (i <= e1 && i <= e2) {
6245
- const n1 = c1[i];
6246
- const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6247
- if (isSameVNodeType(n1, n2)) {
6248
- patch(
6249
- n1,
6250
- n2,
6251
- container,
6252
- null,
6253
- parentComponent,
6254
- parentSuspense,
6255
- namespace,
6256
- slotScopeIds,
6257
- optimized
6258
- );
6259
- } else {
6260
- break;
6261
- }
6262
- i++;
6263
- }
6264
- while (i <= e1 && i <= e2) {
6265
- const n1 = c1[e1];
6266
- const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
6267
- if (isSameVNodeType(n1, n2)) {
6268
- patch(
6269
- n1,
6270
- n2,
6271
- container,
6272
- null,
6273
- parentComponent,
6274
- parentSuspense,
6275
- namespace,
6276
- slotScopeIds,
6277
- optimized
6278
- );
6279
- } else {
6280
- break;
6281
- }
6282
- e1--;
6283
- e2--;
6284
- }
6285
- if (i > e1) {
6286
- if (i <= e2) {
6287
- const nextPos = e2 + 1;
6288
- const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
6289
- while (i <= e2) {
6290
- patch(
6291
- null,
6292
- c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
6293
- container,
6294
- anchor,
6295
- parentComponent,
6296
- parentSuspense,
6297
- namespace,
6298
- slotScopeIds,
6299
- optimized
6300
- );
6301
- i++;
6302
- }
6303
- }
6304
- } else if (i > e2) {
6305
- while (i <= e1) {
6306
- unmount(c1[i], parentComponent, parentSuspense, true);
6307
- i++;
6308
- }
6309
- } else {
6310
- const s1 = i;
6311
- const s2 = i;
6312
- const keyToNewIndexMap = /* @__PURE__ */ new Map();
6313
- for (i = s2; i <= e2; i++) {
6314
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6315
- if (nextChild.key != null) {
6316
- if (keyToNewIndexMap.has(nextChild.key)) {
6317
- warn$1(
6318
- `Duplicate keys found during update:`,
6319
- JSON.stringify(nextChild.key),
6320
- `Make sure keys are unique.`
6321
- );
6322
- }
6323
- keyToNewIndexMap.set(nextChild.key, i);
6324
- }
6325
- }
6326
- let j;
6327
- let patched = 0;
6328
- const toBePatched = e2 - s2 + 1;
6329
- let moved = false;
6330
- let maxNewIndexSoFar = 0;
6331
- const newIndexToOldIndexMap = new Array(toBePatched);
6332
- for (i = 0; i < toBePatched; i++)
6333
- newIndexToOldIndexMap[i] = 0;
6334
- for (i = s1; i <= e1; i++) {
6335
- const prevChild = c1[i];
6336
- if (patched >= toBePatched) {
6337
- unmount(prevChild, parentComponent, parentSuspense, true);
6338
- continue;
6339
- }
6340
- let newIndex;
6341
- if (prevChild.key != null) {
6342
- newIndex = keyToNewIndexMap.get(prevChild.key);
6343
- } else {
6344
- for (j = s2; j <= e2; j++) {
6345
- if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
6346
- newIndex = j;
6347
- break;
6348
- }
6349
- }
6208
+ queuePostRenderEffect(() => {
6209
+ instance2.isDeactivated = false;
6210
+ if (instance2.a) {
6211
+ shared.invokeArrayFns(instance2.a);
6350
6212
  }
6351
- if (newIndex === void 0) {
6352
- unmount(prevChild, parentComponent, parentSuspense, true);
6353
- } else {
6354
- newIndexToOldIndexMap[newIndex - s2] = i + 1;
6355
- if (newIndex >= maxNewIndexSoFar) {
6356
- maxNewIndexSoFar = newIndex;
6357
- } else {
6358
- moved = true;
6359
- }
6360
- patch(
6361
- prevChild,
6362
- c2[newIndex],
6363
- container,
6364
- null,
6365
- parentComponent,
6366
- parentSuspense,
6367
- namespace,
6368
- slotScopeIds,
6369
- optimized
6370
- );
6371
- patched++;
6213
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
6214
+ if (vnodeHook) {
6215
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6372
6216
  }
6217
+ }, parentSuspense);
6218
+ {
6219
+ devtoolsComponentAdded(instance2);
6373
6220
  }
6374
- const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
6375
- j = increasingNewIndexSequence.length - 1;
6376
- for (i = toBePatched - 1; i >= 0; i--) {
6377
- const nextIndex = s2 + i;
6378
- const nextChild = c2[nextIndex];
6379
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
6380
- if (newIndexToOldIndexMap[i] === 0) {
6381
- patch(
6382
- null,
6383
- nextChild,
6384
- container,
6385
- anchor,
6386
- parentComponent,
6387
- parentSuspense,
6388
- namespace,
6389
- slotScopeIds,
6390
- optimized
6391
- );
6392
- } else if (moved) {
6393
- if (j < 0 || i !== increasingNewIndexSequence[j]) {
6394
- move(nextChild, container, anchor, 2);
6395
- } else {
6396
- j--;
6397
- }
6221
+ };
6222
+ sharedContext.deactivate = (vnode) => {
6223
+ const instance2 = vnode.component;
6224
+ invalidateMount(instance2.m);
6225
+ invalidateMount(instance2.a);
6226
+ move(vnode, storageContainer, null, 1, parentSuspense);
6227
+ queuePostRenderEffect(() => {
6228
+ if (instance2.da) {
6229
+ shared.invokeArrayFns(instance2.da);
6398
6230
  }
6231
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
6232
+ if (vnodeHook) {
6233
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6234
+ }
6235
+ instance2.isDeactivated = true;
6236
+ }, parentSuspense);
6237
+ {
6238
+ devtoolsComponentAdded(instance2);
6399
6239
  }
6240
+ };
6241
+ function unmount(vnode) {
6242
+ resetShapeFlag(vnode);
6243
+ _unmount(vnode, instance, parentSuspense, true);
6400
6244
  }
6401
- };
6402
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
6403
- const { el, type, transition, children, shapeFlag } = vnode;
6404
- if (shapeFlag & 6) {
6405
- move(vnode.component.subTree, container, anchor, moveType);
6406
- return;
6407
- }
6408
- if (shapeFlag & 128) {
6409
- vnode.suspense.move(container, anchor, moveType);
6410
- return;
6411
- }
6412
- if (shapeFlag & 64) {
6413
- type.move(vnode, container, anchor, internals);
6414
- return;
6245
+ function pruneCache(filter) {
6246
+ cache.forEach((vnode, key) => {
6247
+ const name = getComponentName(vnode.type);
6248
+ if (name && (!filter || !filter(name))) {
6249
+ pruneCacheEntry(key);
6250
+ }
6251
+ });
6415
6252
  }
6416
- if (type === Fragment) {
6417
- hostInsert(el, container, anchor);
6418
- for (let i = 0; i < children.length; i++) {
6419
- move(children[i], container, anchor, moveType);
6253
+ function pruneCacheEntry(key) {
6254
+ const cached = cache.get(key);
6255
+ if (!current || !isSameVNodeType(cached, current)) {
6256
+ unmount(cached);
6257
+ } else if (current) {
6258
+ resetShapeFlag(current);
6420
6259
  }
6421
- hostInsert(vnode.anchor, container, anchor);
6422
- return;
6423
- }
6424
- if (type === Static) {
6425
- moveStaticNode(vnode, container, anchor);
6426
- return;
6260
+ cache.delete(key);
6261
+ keys.delete(key);
6427
6262
  }
6428
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
6429
- if (needTransition2) {
6430
- if (moveType === 0) {
6431
- transition.beforeEnter(el);
6432
- hostInsert(el, container, anchor);
6433
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
6434
- } else {
6435
- const { leave, delayLeave, afterLeave } = transition;
6436
- const remove2 = () => hostInsert(el, container, anchor);
6437
- const performLeave = () => {
6438
- leave(el, () => {
6439
- remove2();
6440
- afterLeave && afterLeave();
6441
- });
6442
- };
6443
- if (delayLeave) {
6444
- delayLeave(el, remove2, performLeave);
6263
+ watch(
6264
+ () => [props.include, props.exclude],
6265
+ ([include, exclude]) => {
6266
+ include && pruneCache((name) => matches(include, name));
6267
+ exclude && pruneCache((name) => !matches(exclude, name));
6268
+ },
6269
+ // prune post-render after `current` has been updated
6270
+ { flush: "post", deep: true }
6271
+ );
6272
+ let pendingCacheKey = null;
6273
+ const cacheSubtree = () => {
6274
+ if (pendingCacheKey != null) {
6275
+ if (isSuspense(instance.subTree.type)) {
6276
+ queuePostRenderEffect(() => {
6277
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6278
+ }, instance.subTree.suspense);
6445
6279
  } else {
6446
- performLeave();
6280
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6447
6281
  }
6448
6282
  }
6449
- } else {
6450
- hostInsert(el, container, anchor);
6451
- }
6452
- };
6453
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6454
- const {
6455
- type,
6456
- props,
6457
- ref,
6458
- children,
6459
- dynamicChildren,
6460
- shapeFlag,
6461
- patchFlag,
6462
- dirs
6463
- } = vnode;
6464
- if (ref != null) {
6465
- setRef(ref, null, parentSuspense, vnode, true);
6466
- }
6467
- if (shapeFlag & 256) {
6468
- parentComponent.ctx.deactivate(vnode);
6469
- return;
6283
+ };
6284
+ onMounted(cacheSubtree);
6285
+ onUpdated(cacheSubtree);
6286
+ onBeforeUnmount(() => {
6287
+ cache.forEach((cached) => {
6288
+ const { subTree, suspense } = instance;
6289
+ const vnode = getInnerChild(subTree);
6290
+ if (cached.type === vnode.type && cached.key === vnode.key) {
6291
+ resetShapeFlag(vnode);
6292
+ const da = vnode.component.da;
6293
+ da && queuePostRenderEffect(da, suspense);
6294
+ return;
6295
+ }
6296
+ unmount(cached);
6297
+ });
6298
+ });
6299
+ return () => {
6300
+ pendingCacheKey = null;
6301
+ if (!slots.default) {
6302
+ return null;
6303
+ }
6304
+ const children = slots.default();
6305
+ const rawVNode = children[0];
6306
+ if (children.length > 1) {
6307
+ {
6308
+ warn$1(`KeepAlive should contain exactly one component child.`);
6309
+ }
6310
+ current = null;
6311
+ return children;
6312
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
6313
+ current = null;
6314
+ return rawVNode;
6315
+ }
6316
+ let vnode = getInnerChild(rawVNode);
6317
+ const comp = vnode.type;
6318
+ const name = getComponentName(
6319
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
6320
+ );
6321
+ const { include, exclude, max } = props;
6322
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
6323
+ current = vnode;
6324
+ return rawVNode;
6325
+ }
6326
+ const key = vnode.key == null ? comp : vnode.key;
6327
+ const cachedVNode = cache.get(key);
6328
+ if (vnode.el) {
6329
+ vnode = cloneVNode(vnode);
6330
+ if (rawVNode.shapeFlag & 128) {
6331
+ rawVNode.ssContent = vnode;
6332
+ }
6333
+ }
6334
+ pendingCacheKey = key;
6335
+ if (cachedVNode) {
6336
+ vnode.el = cachedVNode.el;
6337
+ vnode.component = cachedVNode.component;
6338
+ if (vnode.transition) {
6339
+ setTransitionHooks(vnode, vnode.transition);
6340
+ }
6341
+ vnode.shapeFlag |= 512;
6342
+ keys.delete(key);
6343
+ keys.add(key);
6344
+ } else {
6345
+ keys.add(key);
6346
+ if (max && keys.size > parseInt(max, 10)) {
6347
+ pruneCacheEntry(keys.values().next().value);
6348
+ }
6349
+ }
6350
+ vnode.shapeFlag |= 256;
6351
+ current = vnode;
6352
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
6353
+ };
6354
+ }
6355
+ };
6356
+ const KeepAlive = KeepAliveImpl;
6357
+ function matches(pattern, name) {
6358
+ if (shared.isArray(pattern)) {
6359
+ return pattern.some((p) => matches(p, name));
6360
+ } else if (shared.isString(pattern)) {
6361
+ return pattern.split(",").includes(name);
6362
+ } else if (shared.isRegExp(pattern)) {
6363
+ return pattern.test(name);
6364
+ }
6365
+ return false;
6366
+ }
6367
+ function onActivated(hook, target) {
6368
+ registerKeepAliveHook(hook, "a", target);
6369
+ }
6370
+ function onDeactivated(hook, target) {
6371
+ registerKeepAliveHook(hook, "da", target);
6372
+ }
6373
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
6374
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
6375
+ let current = target;
6376
+ while (current) {
6377
+ if (current.isDeactivated) {
6378
+ return;
6379
+ }
6380
+ current = current.parent;
6470
6381
  }
6471
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
6472
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
6473
- let vnodeHook;
6474
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
6475
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
6382
+ return hook();
6383
+ });
6384
+ injectHook(type, wrappedHook, target);
6385
+ if (target) {
6386
+ let current = target.parent;
6387
+ while (current && current.parent) {
6388
+ if (isKeepAlive(current.parent.vnode)) {
6389
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
6390
+ }
6391
+ current = current.parent;
6476
6392
  }
6477
- if (shapeFlag & 6) {
6478
- unmountComponent(vnode.component, parentSuspense, doRemove);
6479
- } else {
6480
- if (shapeFlag & 128) {
6481
- vnode.suspense.unmount(parentSuspense, doRemove);
6393
+ }
6394
+ }
6395
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
6396
+ const injected = injectHook(
6397
+ type,
6398
+ hook,
6399
+ keepAliveRoot,
6400
+ true
6401
+ /* prepend */
6402
+ );
6403
+ onUnmounted(() => {
6404
+ shared.remove(keepAliveRoot[type], injected);
6405
+ }, target);
6406
+ }
6407
+ function resetShapeFlag(vnode) {
6408
+ vnode.shapeFlag &= ~256;
6409
+ vnode.shapeFlag &= ~512;
6410
+ }
6411
+ function getInnerChild(vnode) {
6412
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
6413
+ }
6414
+
6415
+ const leaveCbKey = Symbol("_leaveCb");
6416
+ const enterCbKey = Symbol("_enterCb");
6417
+ function useTransitionState() {
6418
+ const state = {
6419
+ isMounted: false,
6420
+ isLeaving: false,
6421
+ isUnmounting: false,
6422
+ leavingVNodes: /* @__PURE__ */ new Map()
6423
+ };
6424
+ onMounted(() => {
6425
+ state.isMounted = true;
6426
+ });
6427
+ onBeforeUnmount(() => {
6428
+ state.isUnmounting = true;
6429
+ });
6430
+ return state;
6431
+ }
6432
+ const TransitionHookValidator = [Function, Array];
6433
+ const BaseTransitionPropsValidators = {
6434
+ mode: String,
6435
+ appear: Boolean,
6436
+ persisted: Boolean,
6437
+ // enter
6438
+ onBeforeEnter: TransitionHookValidator,
6439
+ onEnter: TransitionHookValidator,
6440
+ onAfterEnter: TransitionHookValidator,
6441
+ onEnterCancelled: TransitionHookValidator,
6442
+ // leave
6443
+ onBeforeLeave: TransitionHookValidator,
6444
+ onLeave: TransitionHookValidator,
6445
+ onAfterLeave: TransitionHookValidator,
6446
+ onLeaveCancelled: TransitionHookValidator,
6447
+ // appear
6448
+ onBeforeAppear: TransitionHookValidator,
6449
+ onAppear: TransitionHookValidator,
6450
+ onAfterAppear: TransitionHookValidator,
6451
+ onAppearCancelled: TransitionHookValidator
6452
+ };
6453
+ const recursiveGetSubtree = (instance) => {
6454
+ const subTree = instance.subTree;
6455
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
6456
+ };
6457
+ const BaseTransitionImpl = {
6458
+ name: `BaseTransition`,
6459
+ props: BaseTransitionPropsValidators,
6460
+ setup(props, { slots }) {
6461
+ const instance = getCurrentInstance();
6462
+ const state = useTransitionState();
6463
+ return () => {
6464
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
6465
+ if (!children || !children.length) {
6482
6466
  return;
6483
6467
  }
6484
- if (shouldInvokeDirs) {
6485
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6486
- }
6487
- if (shapeFlag & 64) {
6488
- vnode.type.remove(
6489
- vnode,
6490
- parentComponent,
6491
- parentSuspense,
6492
- optimized,
6493
- internals,
6494
- doRemove
6495
- );
6496
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
6497
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
6498
- unmountChildren(
6499
- dynamicChildren,
6500
- parentComponent,
6501
- parentSuspense,
6502
- false,
6503
- true
6504
- );
6505
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
6506
- unmountChildren(children, parentComponent, parentSuspense);
6507
- }
6508
- if (doRemove) {
6509
- remove(vnode);
6510
- }
6511
- }
6512
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
6513
- queuePostRenderEffect(() => {
6514
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6515
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6516
- }, parentSuspense);
6517
- }
6518
- };
6519
- const remove = (vnode) => {
6520
- const { type, el, anchor, transition } = vnode;
6521
- if (type === Fragment) {
6522
- if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
6523
- vnode.children.forEach((child) => {
6524
- if (child.type === Comment) {
6525
- hostRemove(child.el);
6526
- } else {
6527
- remove(child);
6468
+ let child = children[0];
6469
+ if (children.length > 1) {
6470
+ let hasFound = false;
6471
+ for (const c of children) {
6472
+ if (c.type !== Comment) {
6473
+ if (hasFound) {
6474
+ warn$1(
6475
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
6476
+ );
6477
+ break;
6478
+ }
6479
+ child = c;
6480
+ hasFound = true;
6528
6481
  }
6529
- });
6530
- } else {
6531
- removeFragment(el, anchor);
6532
- }
6533
- return;
6534
- }
6535
- if (type === Static) {
6536
- removeStaticNode(vnode);
6537
- return;
6538
- }
6539
- const performRemove = () => {
6540
- hostRemove(el);
6541
- if (transition && !transition.persisted && transition.afterLeave) {
6542
- transition.afterLeave();
6482
+ }
6543
6483
  }
6544
- };
6545
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6546
- const { leave, delayLeave } = transition;
6547
- const performLeave = () => leave(el, performRemove);
6548
- if (delayLeave) {
6549
- delayLeave(vnode.el, performRemove, performLeave);
6550
- } else {
6551
- performLeave();
6484
+ const rawProps = reactivity.toRaw(props);
6485
+ const { mode } = rawProps;
6486
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
6487
+ warn$1(`invalid <transition> mode: ${mode}`);
6552
6488
  }
6553
- } else {
6554
- performRemove();
6555
- }
6556
- };
6557
- const removeFragment = (cur, end) => {
6558
- let next;
6559
- while (cur !== end) {
6560
- next = hostNextSibling(cur);
6561
- hostRemove(cur);
6562
- cur = next;
6563
- }
6564
- hostRemove(end);
6565
- };
6566
- const unmountComponent = (instance, parentSuspense, doRemove) => {
6567
- if (instance.type.__hmrId) {
6568
- unregisterHMR(instance);
6569
- }
6570
- const { bum, scope, update, subTree, um } = instance;
6571
- if (bum) {
6572
- shared.invokeArrayFns(bum);
6573
- }
6574
- scope.stop();
6575
- if (update) {
6576
- update.active = false;
6577
- unmount(subTree, instance, parentSuspense, doRemove);
6578
- }
6579
- if (um) {
6580
- queuePostRenderEffect(um, parentSuspense);
6581
- }
6582
- queuePostRenderEffect(() => {
6583
- instance.isUnmounted = true;
6584
- }, parentSuspense);
6585
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
6586
- parentSuspense.deps--;
6587
- if (parentSuspense.deps === 0) {
6588
- parentSuspense.resolve();
6489
+ if (state.isLeaving) {
6490
+ return emptyPlaceholder(child);
6589
6491
  }
6590
- }
6591
- {
6592
- devtoolsComponentRemoved(instance);
6593
- }
6594
- };
6595
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
6596
- for (let i = start; i < children.length; i++) {
6597
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
6598
- }
6599
- };
6600
- const getNextHostNode = (vnode) => {
6601
- if (vnode.shapeFlag & 6) {
6602
- return getNextHostNode(vnode.component.subTree);
6603
- }
6604
- if (vnode.shapeFlag & 128) {
6605
- return vnode.suspense.next();
6606
- }
6607
- return hostNextSibling(vnode.anchor || vnode.el);
6608
- };
6609
- let isFlushing = false;
6610
- const render = (vnode, container, namespace) => {
6611
- if (vnode == null) {
6612
- if (container._vnode) {
6613
- unmount(container._vnode, null, null, true);
6492
+ const innerChild = getKeepAliveChild(child);
6493
+ if (!innerChild) {
6494
+ return emptyPlaceholder(child);
6614
6495
  }
6615
- } else {
6616
- patch(
6617
- container._vnode || null,
6618
- vnode,
6619
- container,
6620
- null,
6621
- null,
6622
- null,
6623
- namespace
6496
+ let enterHooks = resolveTransitionHooks(
6497
+ innerChild,
6498
+ rawProps,
6499
+ state,
6500
+ instance,
6501
+ // #11061, ensure enterHooks is fresh after clone
6502
+ (hooks) => enterHooks = hooks
6624
6503
  );
6625
- }
6626
- if (!isFlushing) {
6627
- isFlushing = true;
6628
- flushPreFlushCbs();
6629
- flushPostFlushCbs();
6630
- isFlushing = false;
6631
- }
6632
- container._vnode = vnode;
6633
- };
6634
- const internals = {
6635
- p: patch,
6636
- um: unmount,
6637
- m: move,
6638
- r: remove,
6639
- mt: mountComponent,
6640
- mc: mountChildren,
6641
- pc: patchChildren,
6642
- pbc: patchBlockChildren,
6643
- n: getNextHostNode,
6644
- o: options
6645
- };
6646
- let hydrate;
6647
- let hydrateNode;
6648
- if (createHydrationFns) {
6649
- [hydrate, hydrateNode] = createHydrationFns(
6650
- internals
6651
- );
6504
+ setTransitionHooks(innerChild, enterHooks);
6505
+ const oldChild = instance.subTree;
6506
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
6507
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
6508
+ const leavingHooks = resolveTransitionHooks(
6509
+ oldInnerChild,
6510
+ rawProps,
6511
+ state,
6512
+ instance
6513
+ );
6514
+ setTransitionHooks(oldInnerChild, leavingHooks);
6515
+ if (mode === "out-in" && innerChild.type !== Comment) {
6516
+ state.isLeaving = true;
6517
+ leavingHooks.afterLeave = () => {
6518
+ state.isLeaving = false;
6519
+ if (instance.update.active !== false) {
6520
+ instance.effect.dirty = true;
6521
+ instance.update();
6522
+ }
6523
+ };
6524
+ return emptyPlaceholder(child);
6525
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
6526
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
6527
+ const leavingVNodesCache = getLeavingNodesForType(
6528
+ state,
6529
+ oldInnerChild
6530
+ );
6531
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
6532
+ el[leaveCbKey] = () => {
6533
+ earlyRemove();
6534
+ el[leaveCbKey] = void 0;
6535
+ delete enterHooks.delayedLeave;
6536
+ };
6537
+ enterHooks.delayedLeave = delayedLeave;
6538
+ };
6539
+ }
6540
+ }
6541
+ return child;
6542
+ };
6652
6543
  }
6653
- return {
6654
- render,
6655
- hydrate,
6656
- createApp: createAppAPI(render, hydrate)
6657
- };
6658
- }
6659
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
6660
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6661
- }
6662
- function toggleRecurse({ effect, update }, allowed) {
6663
- effect.allowRecurse = update.allowRecurse = allowed;
6664
- }
6665
- function needTransition(parentSuspense, transition) {
6666
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6544
+ };
6545
+ const BaseTransition = BaseTransitionImpl;
6546
+ function getLeavingNodesForType(state, vnode) {
6547
+ const { leavingVNodes } = state;
6548
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
6549
+ if (!leavingVNodesCache) {
6550
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
6551
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
6552
+ }
6553
+ return leavingVNodesCache;
6667
6554
  }
6668
- function traverseStaticChildren(n1, n2, shallow = false) {
6669
- const ch1 = n1.children;
6670
- const ch2 = n2.children;
6671
- if (shared.isArray(ch1) && shared.isArray(ch2)) {
6672
- for (let i = 0; i < ch1.length; i++) {
6673
- const c1 = ch1[i];
6674
- let c2 = ch2[i];
6675
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
6676
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
6677
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
6678
- c2.el = c1.el;
6555
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
6556
+ const {
6557
+ appear,
6558
+ mode,
6559
+ persisted = false,
6560
+ onBeforeEnter,
6561
+ onEnter,
6562
+ onAfterEnter,
6563
+ onEnterCancelled,
6564
+ onBeforeLeave,
6565
+ onLeave,
6566
+ onAfterLeave,
6567
+ onLeaveCancelled,
6568
+ onBeforeAppear,
6569
+ onAppear,
6570
+ onAfterAppear,
6571
+ onAppearCancelled
6572
+ } = props;
6573
+ const key = String(vnode.key);
6574
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
6575
+ const callHook = (hook, args) => {
6576
+ hook && callWithAsyncErrorHandling(
6577
+ hook,
6578
+ instance,
6579
+ 9,
6580
+ args
6581
+ );
6582
+ };
6583
+ const callAsyncHook = (hook, args) => {
6584
+ const done = args[1];
6585
+ callHook(hook, args);
6586
+ if (shared.isArray(hook)) {
6587
+ if (hook.every((hook2) => hook2.length <= 1)) done();
6588
+ } else if (hook.length <= 1) {
6589
+ done();
6590
+ }
6591
+ };
6592
+ const hooks = {
6593
+ mode,
6594
+ persisted,
6595
+ beforeEnter(el) {
6596
+ let hook = onBeforeEnter;
6597
+ if (!state.isMounted) {
6598
+ if (appear) {
6599
+ hook = onBeforeAppear || onBeforeEnter;
6600
+ } else {
6601
+ return;
6679
6602
  }
6680
- if (!shallow)
6681
- traverseStaticChildren(c1, c2);
6682
6603
  }
6683
- if (c2.type === Text) {
6684
- c2.el = c1.el;
6604
+ if (el[leaveCbKey]) {
6605
+ el[leaveCbKey](
6606
+ true
6607
+ /* cancelled */
6608
+ );
6685
6609
  }
6686
- if (c2.type === Comment && !c2.el) {
6687
- c2.el = c1.el;
6610
+ const leavingVNode = leavingVNodesCache[key];
6611
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
6612
+ leavingVNode.el[leaveCbKey]();
6688
6613
  }
6689
- }
6690
- }
6691
- }
6692
- function getSequence(arr) {
6693
- const p = arr.slice();
6694
- const result = [0];
6695
- let i, j, u, v, c;
6696
- const len = arr.length;
6697
- for (i = 0; i < len; i++) {
6698
- const arrI = arr[i];
6699
- if (arrI !== 0) {
6700
- j = result[result.length - 1];
6701
- if (arr[j] < arrI) {
6702
- p[i] = j;
6703
- result.push(i);
6704
- continue;
6614
+ callHook(hook, [el]);
6615
+ },
6616
+ enter(el) {
6617
+ let hook = onEnter;
6618
+ let afterHook = onAfterEnter;
6619
+ let cancelHook = onEnterCancelled;
6620
+ if (!state.isMounted) {
6621
+ if (appear) {
6622
+ hook = onAppear || onEnter;
6623
+ afterHook = onAfterAppear || onAfterEnter;
6624
+ cancelHook = onAppearCancelled || onEnterCancelled;
6625
+ } else {
6626
+ return;
6627
+ }
6705
6628
  }
6706
- u = 0;
6707
- v = result.length - 1;
6708
- while (u < v) {
6709
- c = u + v >> 1;
6710
- if (arr[result[c]] < arrI) {
6711
- u = c + 1;
6629
+ let called = false;
6630
+ const done = el[enterCbKey] = (cancelled) => {
6631
+ if (called) return;
6632
+ called = true;
6633
+ if (cancelled) {
6634
+ callHook(cancelHook, [el]);
6712
6635
  } else {
6713
- v = c;
6636
+ callHook(afterHook, [el]);
6637
+ }
6638
+ if (hooks.delayedLeave) {
6639
+ hooks.delayedLeave();
6714
6640
  }
6641
+ el[enterCbKey] = void 0;
6642
+ };
6643
+ if (hook) {
6644
+ callAsyncHook(hook, [el, done]);
6645
+ } else {
6646
+ done();
6715
6647
  }
6716
- if (arrI < arr[result[u]]) {
6717
- if (u > 0) {
6718
- p[i] = result[u - 1];
6648
+ },
6649
+ leave(el, remove) {
6650
+ const key2 = String(vnode.key);
6651
+ if (el[enterCbKey]) {
6652
+ el[enterCbKey](
6653
+ true
6654
+ /* cancelled */
6655
+ );
6656
+ }
6657
+ if (state.isUnmounting) {
6658
+ return remove();
6659
+ }
6660
+ callHook(onBeforeLeave, [el]);
6661
+ let called = false;
6662
+ const done = el[leaveCbKey] = (cancelled) => {
6663
+ if (called) return;
6664
+ called = true;
6665
+ remove();
6666
+ if (cancelled) {
6667
+ callHook(onLeaveCancelled, [el]);
6668
+ } else {
6669
+ callHook(onAfterLeave, [el]);
6719
6670
  }
6720
- result[u] = i;
6671
+ el[leaveCbKey] = void 0;
6672
+ if (leavingVNodesCache[key2] === vnode) {
6673
+ delete leavingVNodesCache[key2];
6674
+ }
6675
+ };
6676
+ leavingVNodesCache[key2] = vnode;
6677
+ if (onLeave) {
6678
+ callAsyncHook(onLeave, [el, done]);
6679
+ } else {
6680
+ done();
6721
6681
  }
6682
+ },
6683
+ clone(vnode2) {
6684
+ const hooks2 = resolveTransitionHooks(
6685
+ vnode2,
6686
+ props,
6687
+ state,
6688
+ instance,
6689
+ postClone
6690
+ );
6691
+ if (postClone) postClone(hooks2);
6692
+ return hooks2;
6693
+ }
6694
+ };
6695
+ return hooks;
6696
+ }
6697
+ function emptyPlaceholder(vnode) {
6698
+ if (isKeepAlive(vnode)) {
6699
+ vnode = cloneVNode(vnode);
6700
+ vnode.children = null;
6701
+ return vnode;
6702
+ }
6703
+ }
6704
+ function getKeepAliveChild(vnode) {
6705
+ if (!isKeepAlive(vnode)) {
6706
+ return vnode;
6707
+ }
6708
+ if (vnode.component) {
6709
+ return vnode.component.subTree;
6710
+ }
6711
+ const { shapeFlag, children } = vnode;
6712
+ if (children) {
6713
+ if (shapeFlag & 16) {
6714
+ return children[0];
6715
+ }
6716
+ if (shapeFlag & 32 && shared.isFunction(children.default)) {
6717
+ return children.default();
6722
6718
  }
6723
6719
  }
6724
- u = result.length;
6725
- v = result[u - 1];
6726
- while (u-- > 0) {
6727
- result[u] = v;
6728
- v = p[v];
6720
+ }
6721
+ function setTransitionHooks(vnode, hooks) {
6722
+ if (vnode.shapeFlag & 6 && vnode.component) {
6723
+ setTransitionHooks(vnode.component.subTree, hooks);
6724
+ } else if (vnode.shapeFlag & 128) {
6725
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
6726
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
6727
+ } else {
6728
+ vnode.transition = hooks;
6729
6729
  }
6730
- return result;
6731
6730
  }
6732
- function locateNonHydratedAsyncRoot(instance) {
6733
- const subComponent = instance.subTree.component;
6734
- if (subComponent) {
6735
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
6736
- return subComponent;
6737
- } else {
6738
- return locateNonHydratedAsyncRoot(subComponent);
6731
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
6732
+ let ret = [];
6733
+ let keyedFragmentCount = 0;
6734
+ for (let i = 0; i < children.length; i++) {
6735
+ let child = children[i];
6736
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
6737
+ if (child.type === Fragment) {
6738
+ if (child.patchFlag & 128) keyedFragmentCount++;
6739
+ ret = ret.concat(
6740
+ getTransitionRawChildren(child.children, keepComment, key)
6741
+ );
6742
+ } else if (keepComment || child.type !== Comment) {
6743
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
6744
+ }
6745
+ }
6746
+ if (keyedFragmentCount > 1) {
6747
+ for (let i = 0; i < ret.length; i++) {
6748
+ ret[i].patchFlag = -2;
6739
6749
  }
6740
6750
  }
6751
+ return ret;
6741
6752
  }
6742
6753
 
6743
6754
  const isTeleport = (type) => type.__isTeleport;
@@ -6754,7 +6765,7 @@ const resolveTarget = (props, select) => {
6754
6765
  return null;
6755
6766
  } else {
6756
6767
  const target = select(targetSelector);
6757
- if (!target) {
6768
+ if (!target && !isTeleportDisabled(props)) {
6758
6769
  warn$1(
6759
6770
  `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.`
6760
6771
  );
@@ -7006,8 +7017,7 @@ function updateCssVars(vnode) {
7006
7017
  if (ctx && ctx.ut) {
7007
7018
  let node = vnode.children[0].el;
7008
7019
  while (node && node !== vnode.targetAnchor) {
7009
- if (node.nodeType === 1)
7010
- node.setAttribute("data-v-owner", ctx.uid);
7020
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
7011
7021
  node = node.nextSibling;
7012
7022
  }
7013
7023
  ctx.ut();
@@ -7173,7 +7183,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
7173
7183
  currentBlock.push(cloned);
7174
7184
  }
7175
7185
  }
7176
- cloned.patchFlag |= -2;
7186
+ cloned.patchFlag = -2;
7177
7187
  return cloned;
7178
7188
  }
7179
7189
  if (isClassComponent(type)) {
@@ -7214,8 +7224,7 @@ Component that was made reactive: `,
7214
7224
  );
7215
7225
  }
7216
7226
  function guardReactiveProps(props) {
7217
- if (!props)
7218
- return null;
7227
+ if (!props) return null;
7219
7228
  return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
7220
7229
  }
7221
7230
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
@@ -7264,7 +7273,10 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7264
7273
  ce: vnode.ce
7265
7274
  };
7266
7275
  if (transition && cloneTransition) {
7267
- cloned.transition = transition.clone(cloned);
7276
+ setTransitionHooks(
7277
+ cloned,
7278
+ transition.clone(cloned)
7279
+ );
7268
7280
  }
7269
7281
  return cloned;
7270
7282
  }
@@ -7480,14 +7492,11 @@ let setInSSRSetupState;
7480
7492
  const g = shared.getGlobalThis();
7481
7493
  const registerGlobalSetter = (key, setter) => {
7482
7494
  let setters;
7483
- if (!(setters = g[key]))
7484
- setters = g[key] = [];
7495
+ if (!(setters = g[key])) setters = g[key] = [];
7485
7496
  setters.push(setter);
7486
7497
  return (v) => {
7487
- if (setters.length > 1)
7488
- setters.forEach((set) => set(v));
7489
- else
7490
- setters[0](v);
7498
+ if (setters.length > 1) setters.forEach((set) => set(v));
7499
+ else setters[0](v);
7491
7500
  };
7492
7501
  };
7493
7502
  internalSetCurrentInstance = registerGlobalSetter(
@@ -7690,7 +7699,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7690
7699
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (``)
7691
7700
  );
7692
7701
  } else {
7693
- warn$1(`Component is missing template or render function.`);
7702
+ warn$1(`Component is missing template or render function: `, Component);
7694
7703
  }
7695
7704
  }
7696
7705
  }
@@ -7757,7 +7766,7 @@ function createSetupContext(instance) {
7757
7766
  });
7758
7767
  }
7759
7768
  }
7760
- function getExposeProxy(instance) {
7769
+ function getComponentPublicInstance(instance) {
7761
7770
  if (instance.exposed) {
7762
7771
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
7763
7772
  get(target, key) {
@@ -7771,6 +7780,8 @@ function getExposeProxy(instance) {
7771
7780
  return key in target || key in publicPropertiesMap;
7772
7781
  }
7773
7782
  }));
7783
+ } else {
7784
+ return instance.proxy;
7774
7785
  }
7775
7786
  }
7776
7787
  const classifyRE = /(?:^|[-_])(\w)/g;
@@ -8072,6 +8083,7 @@ function withMemo(memo, render, cache, index) {
8072
8083
  }
8073
8084
  const ret = render();
8074
8085
  ret.memo = memo.slice();
8086
+ ret.memoIndex = index;
8075
8087
  return cache[index] = ret;
8076
8088
  }
8077
8089
  function isMemoSame(cached, memo) {
@@ -8090,7 +8102,7 @@ function isMemoSame(cached, memo) {
8090
8102
  return true;
8091
8103
  }
8092
8104
 
8093
- const version = "3.4.27";
8105
+ const version = "3.4.28";
8094
8106
  const warn = warn$1 ;
8095
8107
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8096
8108
  const devtools = devtools$1 ;
@@ -8101,7 +8113,8 @@ const _ssrUtils = {
8101
8113
  renderComponentRoot,
8102
8114
  setCurrentRenderingInstance,
8103
8115
  isVNode: isVNode,
8104
- normalizeVNode
8116
+ normalizeVNode,
8117
+ getComponentPublicInstance
8105
8118
  };
8106
8119
  const ssrUtils = _ssrUtils ;
8107
8120
  const resolveFilter = null;