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