@vue/compat 3.4.31 → 3.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.31
2
+ * @vue/compat v3.4.32
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -874,18 +874,18 @@ const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true
874
874
 
875
875
  const toShallow = (value) => value;
876
876
  const getProto = (v) => Reflect.getPrototypeOf(v);
877
- function get(target, key, isReadonly = false, isShallow = false) {
877
+ function get(target, key, isReadonly2 = false, isShallow2 = false) {
878
878
  target = target["__v_raw"];
879
879
  const rawTarget = toRaw(target);
880
880
  const rawKey = toRaw(key);
881
- if (!isReadonly) {
881
+ if (!isReadonly2) {
882
882
  if (hasChanged(key, rawKey)) {
883
883
  track(rawTarget, "get", key);
884
884
  }
885
885
  track(rawTarget, "get", rawKey);
886
886
  }
887
887
  const { has: has2 } = getProto(rawTarget);
888
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
888
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
889
889
  if (has2.call(rawTarget, key)) {
890
890
  return wrap(target.get(key));
891
891
  } else if (has2.call(rawTarget, rawKey)) {
@@ -894,11 +894,11 @@ function get(target, key, isReadonly = false, isShallow = false) {
894
894
  target.get(key);
895
895
  }
896
896
  }
897
- function has(key, isReadonly = false) {
897
+ function has(key, isReadonly2 = false) {
898
898
  const target = this["__v_raw"];
899
899
  const rawTarget = toRaw(target);
900
900
  const rawKey = toRaw(key);
901
- if (!isReadonly) {
901
+ if (!isReadonly2) {
902
902
  if (hasChanged(key, rawKey)) {
903
903
  track(rawTarget, "has", key);
904
904
  }
@@ -906,13 +906,15 @@ function has(key, isReadonly = false) {
906
906
  }
907
907
  return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
908
908
  }
909
- function size(target, isReadonly = false) {
909
+ function size(target, isReadonly2 = false) {
910
910
  target = target["__v_raw"];
911
- !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
911
+ !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
912
912
  return Reflect.get(target, "size", target);
913
913
  }
914
- function add(value) {
915
- value = toRaw(value);
914
+ function add(value, _isShallow = false) {
915
+ if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
916
+ value = toRaw(value);
917
+ }
916
918
  const target = toRaw(this);
917
919
  const proto = getProto(target);
918
920
  const hadKey = proto.has.call(target, value);
@@ -922,8 +924,10 @@ function add(value) {
922
924
  }
923
925
  return this;
924
926
  }
925
- function set(key, value) {
926
- value = toRaw(value);
927
+ function set(key, value, _isShallow = false) {
928
+ if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
929
+ value = toRaw(value);
930
+ }
927
931
  const target = toRaw(this);
928
932
  const { has: has2, get: get2 } = getProto(target);
929
933
  let hadKey = has2.call(target, key);
@@ -964,19 +968,19 @@ function clear() {
964
968
  }
965
969
  return result;
966
970
  }
967
- function createForEach(isReadonly, isShallow) {
971
+ function createForEach(isReadonly2, isShallow2) {
968
972
  return function forEach(callback, thisArg) {
969
973
  const observed = this;
970
974
  const target = observed["__v_raw"];
971
975
  const rawTarget = toRaw(target);
972
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
973
- !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
976
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
977
+ !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
974
978
  return target.forEach((value, key) => {
975
979
  return callback.call(thisArg, wrap(value), wrap(key), observed);
976
980
  });
977
981
  };
978
982
  }
979
- function createIterableMethod(method, isReadonly, isShallow) {
983
+ function createIterableMethod(method, isReadonly2, isShallow2) {
980
984
  return function(...args) {
981
985
  const target = this["__v_raw"];
982
986
  const rawTarget = toRaw(target);
@@ -984,8 +988,8 @@ function createIterableMethod(method, isReadonly, isShallow) {
984
988
  const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
985
989
  const isKeyOnly = method === "keys" && targetIsMap;
986
990
  const innerIterator = target[method](...args);
987
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
988
- !isReadonly && track(
991
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
992
+ !isReadonly2 && track(
989
993
  rawTarget,
990
994
  "iterate",
991
995
  isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
@@ -1034,8 +1038,12 @@ function createInstrumentations() {
1034
1038
  return size(this);
1035
1039
  },
1036
1040
  has,
1037
- add,
1038
- set,
1041
+ add(value) {
1042
+ return add.call(this, value, true);
1043
+ },
1044
+ set(key, value) {
1045
+ return set.call(this, key, value, true);
1046
+ },
1039
1047
  delete: deleteEntry,
1040
1048
  clear,
1041
1049
  forEach: createForEach(false, true)
@@ -1101,13 +1109,13 @@ const [
1101
1109
  shallowInstrumentations,
1102
1110
  shallowReadonlyInstrumentations
1103
1111
  ] = /* @__PURE__ */ createInstrumentations();
1104
- function createInstrumentationGetter(isReadonly, shallow) {
1105
- const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
1112
+ function createInstrumentationGetter(isReadonly2, shallow) {
1113
+ const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
1106
1114
  return (target, key, receiver) => {
1107
1115
  if (key === "__v_isReactive") {
1108
- return !isReadonly;
1116
+ return !isReadonly2;
1109
1117
  } else if (key === "__v_isReadonly") {
1110
- return isReadonly;
1118
+ return isReadonly2;
1111
1119
  } else if (key === "__v_raw") {
1112
1120
  return target;
1113
1121
  }
@@ -1498,7 +1506,9 @@ const ErrorCodes = {
1498
1506
  "ASYNC_COMPONENT_LOADER": 13,
1499
1507
  "13": "ASYNC_COMPONENT_LOADER",
1500
1508
  "SCHEDULER": 14,
1501
- "14": "SCHEDULER"
1509
+ "14": "SCHEDULER",
1510
+ "COMPONENT_UPDATE": 15,
1511
+ "15": "COMPONENT_UPDATE"
1502
1512
  };
1503
1513
  const ErrorTypeStrings$1 = {
1504
1514
  ["sp"]: "serverPrefetch hook",
@@ -1529,7 +1539,8 @@ const ErrorTypeStrings$1 = {
1529
1539
  [11]: "app warnHandler",
1530
1540
  [12]: "ref function",
1531
1541
  [13]: "async component loader",
1532
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1542
+ [14]: "scheduler flush",
1543
+ [15]: "component update"
1533
1544
  };
1534
1545
  function callWithErrorHandling(fn, instance, type, args) {
1535
1546
  try {
@@ -1710,7 +1721,11 @@ function flushJobs(seen) {
1710
1721
  const job = queue[flushIndex];
1711
1722
  if (job && job.active !== false) {
1712
1723
  if (false) ;
1713
- callWithErrorHandling(job, null, 14);
1724
+ callWithErrorHandling(
1725
+ job,
1726
+ job.i,
1727
+ job.i ? 15 : 14
1728
+ );
1714
1729
  }
1715
1730
  }
1716
1731
  } finally {
@@ -1936,110 +1951,6 @@ function compatModelEmit(instance, event, args) {
1936
1951
  }
1937
1952
  }
1938
1953
 
1939
- function emit(instance, event, ...rawArgs) {
1940
- if (instance.isUnmounted) return;
1941
- const props = instance.vnode.props || EMPTY_OBJ;
1942
- let args = rawArgs;
1943
- const isModelListener = event.startsWith("update:");
1944
- const modelArg = isModelListener && event.slice(7);
1945
- if (modelArg && modelArg in props) {
1946
- const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
1947
- const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
1948
- if (trim) {
1949
- args = rawArgs.map((a) => isString(a) ? a.trim() : a);
1950
- }
1951
- if (number) {
1952
- args = rawArgs.map(looseToNumber);
1953
- }
1954
- }
1955
- let handlerName;
1956
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
1957
- props[handlerName = toHandlerKey(camelize(event))];
1958
- if (!handler && isModelListener) {
1959
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
1960
- }
1961
- if (handler) {
1962
- callWithAsyncErrorHandling(
1963
- handler,
1964
- instance,
1965
- 6,
1966
- args
1967
- );
1968
- }
1969
- const onceHandler = props[handlerName + `Once`];
1970
- if (onceHandler) {
1971
- if (!instance.emitted) {
1972
- instance.emitted = {};
1973
- } else if (instance.emitted[handlerName]) {
1974
- return;
1975
- }
1976
- instance.emitted[handlerName] = true;
1977
- callWithAsyncErrorHandling(
1978
- onceHandler,
1979
- instance,
1980
- 6,
1981
- args
1982
- );
1983
- }
1984
- {
1985
- compatModelEmit(instance, event, args);
1986
- return emit$1(instance, event, args);
1987
- }
1988
- }
1989
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1990
- const cache = appContext.emitsCache;
1991
- const cached = cache.get(comp);
1992
- if (cached !== void 0) {
1993
- return cached;
1994
- }
1995
- const raw = comp.emits;
1996
- let normalized = {};
1997
- let hasExtends = false;
1998
- if (!isFunction(comp)) {
1999
- const extendEmits = (raw2) => {
2000
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
2001
- if (normalizedFromExtend) {
2002
- hasExtends = true;
2003
- extend(normalized, normalizedFromExtend);
2004
- }
2005
- };
2006
- if (!asMixin && appContext.mixins.length) {
2007
- appContext.mixins.forEach(extendEmits);
2008
- }
2009
- if (comp.extends) {
2010
- extendEmits(comp.extends);
2011
- }
2012
- if (comp.mixins) {
2013
- comp.mixins.forEach(extendEmits);
2014
- }
2015
- }
2016
- if (!raw && !hasExtends) {
2017
- if (isObject(comp)) {
2018
- cache.set(comp, null);
2019
- }
2020
- return null;
2021
- }
2022
- if (isArray(raw)) {
2023
- raw.forEach((key) => normalized[key] = null);
2024
- } else {
2025
- extend(normalized, raw);
2026
- }
2027
- if (isObject(comp)) {
2028
- cache.set(comp, normalized);
2029
- }
2030
- return normalized;
2031
- }
2032
- function isEmitListener(options, key) {
2033
- if (!options || !isOn(key)) {
2034
- return false;
2035
- }
2036
- if (key.startsWith(compatModelEventPrefix)) {
2037
- return true;
2038
- }
2039
- key = key.slice(2).replace(/Once$/, "");
2040
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
2041
- }
2042
-
2043
1954
  let currentRenderingInstance = null;
2044
1955
  let currentScopeId = null;
2045
1956
  function setCurrentRenderingInstance(instance) {
@@ -2088,975 +1999,858 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2088
1999
  return renderFnWithContext;
2089
2000
  }
2090
2001
 
2091
- function markAttrsAccessed() {
2092
- }
2093
- function renderComponentRoot(instance) {
2094
- const {
2095
- type: Component,
2096
- vnode,
2097
- proxy,
2098
- withProxy,
2099
- propsOptions: [propsOptions],
2100
- slots,
2101
- attrs,
2102
- emit,
2103
- render,
2104
- renderCache,
2105
- props,
2106
- data,
2107
- setupState,
2108
- ctx,
2109
- inheritAttrs
2110
- } = instance;
2111
- const prev = setCurrentRenderingInstance(instance);
2112
- let result;
2113
- let fallthroughAttrs;
2114
- try {
2115
- if (vnode.shapeFlag & 4) {
2116
- const proxyToUse = withProxy || proxy;
2117
- const thisProxy = false ? new Proxy(proxyToUse, {
2118
- get(target, key, receiver) {
2119
- warn(
2120
- `Property '${String(
2121
- key
2122
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
2002
+ const legacyDirectiveHookMap = {
2003
+ beforeMount: "bind",
2004
+ mounted: "inserted",
2005
+ updated: ["update", "componentUpdated"],
2006
+ unmounted: "unbind"
2007
+ };
2008
+ function mapCompatDirectiveHook(name, dir, instance) {
2009
+ const mappedName = legacyDirectiveHookMap[name];
2010
+ if (mappedName) {
2011
+ if (isArray(mappedName)) {
2012
+ const hook = [];
2013
+ mappedName.forEach((mapped) => {
2014
+ const mappedHook = dir[mapped];
2015
+ if (mappedHook) {
2016
+ softAssertCompatEnabled(
2017
+ "CUSTOM_DIR",
2018
+ instance,
2019
+ mapped,
2020
+ name
2123
2021
  );
2124
- return Reflect.get(target, key, receiver);
2022
+ hook.push(mappedHook);
2125
2023
  }
2126
- }) : proxyToUse;
2127
- result = normalizeVNode(
2128
- render.call(
2129
- thisProxy,
2130
- proxyToUse,
2131
- renderCache,
2132
- false ? shallowReadonly(props) : props,
2133
- setupState,
2134
- data,
2135
- ctx
2136
- )
2137
- );
2138
- fallthroughAttrs = attrs;
2024
+ });
2025
+ return hook.length ? hook : void 0;
2139
2026
  } else {
2140
- const render2 = Component;
2141
- if (false) ;
2142
- result = normalizeVNode(
2143
- render2.length > 1 ? render2(
2144
- false ? shallowReadonly(props) : props,
2145
- false ? {
2146
- get attrs() {
2147
- markAttrsAccessed();
2148
- return shallowReadonly(attrs);
2149
- },
2150
- slots,
2151
- emit
2152
- } : { attrs, slots, emit }
2153
- ) : render2(
2154
- false ? shallowReadonly(props) : props,
2155
- null
2156
- )
2157
- );
2158
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
2027
+ if (dir[mappedName]) {
2028
+ softAssertCompatEnabled(
2029
+ "CUSTOM_DIR",
2030
+ instance,
2031
+ mappedName,
2032
+ name
2033
+ );
2034
+ }
2035
+ return dir[mappedName];
2159
2036
  }
2160
- } catch (err) {
2161
- blockStack.length = 0;
2162
- handleError(err, instance, 1);
2163
- result = createVNode(Comment);
2164
2037
  }
2165
- let root = result;
2166
- if (fallthroughAttrs && inheritAttrs !== false) {
2167
- const keys = Object.keys(fallthroughAttrs);
2168
- const { shapeFlag } = root;
2169
- if (keys.length) {
2170
- if (shapeFlag & (1 | 6)) {
2171
- if (propsOptions && keys.some(isModelListener)) {
2172
- fallthroughAttrs = filterModelListeners(
2173
- fallthroughAttrs,
2174
- propsOptions
2175
- );
2176
- }
2177
- root = cloneVNode(root, fallthroughAttrs, false, true);
2038
+ }
2039
+
2040
+ function withDirectives(vnode, directives) {
2041
+ if (currentRenderingInstance === null) {
2042
+ return vnode;
2043
+ }
2044
+ const instance = getComponentPublicInstance(currentRenderingInstance);
2045
+ const bindings = vnode.dirs || (vnode.dirs = []);
2046
+ for (let i = 0; i < directives.length; i++) {
2047
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2048
+ if (dir) {
2049
+ if (isFunction(dir)) {
2050
+ dir = {
2051
+ mounted: dir,
2052
+ updated: dir
2053
+ };
2054
+ }
2055
+ if (dir.deep) {
2056
+ traverse(value);
2178
2057
  }
2058
+ bindings.push({
2059
+ dir,
2060
+ instance,
2061
+ value,
2062
+ oldValue: void 0,
2063
+ arg,
2064
+ modifiers
2065
+ });
2179
2066
  }
2180
2067
  }
2181
- if (isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance) && vnode.shapeFlag & 4 && root.shapeFlag & (1 | 6)) {
2182
- const { class: cls, style } = vnode.props || {};
2183
- if (cls || style) {
2184
- root = cloneVNode(
2185
- root,
2186
- {
2187
- class: cls,
2188
- style
2189
- },
2190
- false,
2191
- true
2192
- );
2193
- }
2194
- }
2195
- if (vnode.dirs) {
2196
- root = cloneVNode(root, null, false, true);
2197
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2198
- }
2199
- if (vnode.transition) {
2200
- root.transition = vnode.transition;
2201
- }
2202
- {
2203
- result = root;
2204
- }
2205
- setCurrentRenderingInstance(prev);
2206
- return result;
2068
+ return vnode;
2207
2069
  }
2208
- function filterSingleRoot(children, recurse = true) {
2209
- let singleRoot;
2210
- for (let i = 0; i < children.length; i++) {
2211
- const child = children[i];
2212
- if (isVNode(child)) {
2213
- if (child.type !== Comment || child.children === "v-if") {
2214
- if (singleRoot) {
2215
- return;
2216
- } else {
2217
- singleRoot = child;
2218
- }
2219
- }
2220
- } else {
2221
- return;
2070
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2071
+ const bindings = vnode.dirs;
2072
+ const oldBindings = prevVNode && prevVNode.dirs;
2073
+ for (let i = 0; i < bindings.length; i++) {
2074
+ const binding = bindings[i];
2075
+ if (oldBindings) {
2076
+ binding.oldValue = oldBindings[i].value;
2222
2077
  }
2223
- }
2224
- return singleRoot;
2225
- }
2226
- const getFunctionalFallthrough = (attrs) => {
2227
- let res;
2228
- for (const key in attrs) {
2229
- if (key === "class" || key === "style" || isOn(key)) {
2230
- (res || (res = {}))[key] = attrs[key];
2078
+ let hook = binding.dir[name];
2079
+ if (!hook) {
2080
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
2231
2081
  }
2232
- }
2233
- return res;
2234
- };
2235
- const filterModelListeners = (attrs, props) => {
2236
- const res = {};
2237
- for (const key in attrs) {
2238
- if (!isModelListener(key) || !(key.slice(9) in props)) {
2239
- res[key] = attrs[key];
2082
+ if (hook) {
2083
+ pauseTracking();
2084
+ callWithAsyncErrorHandling(hook, instance, 8, [
2085
+ vnode.el,
2086
+ binding,
2087
+ vnode,
2088
+ prevVNode
2089
+ ]);
2090
+ resetTracking();
2240
2091
  }
2241
2092
  }
2242
- return res;
2093
+ }
2094
+
2095
+ const leaveCbKey = Symbol("_leaveCb");
2096
+ const enterCbKey$1 = Symbol("_enterCb");
2097
+ function useTransitionState() {
2098
+ const state = {
2099
+ isMounted: false,
2100
+ isLeaving: false,
2101
+ isUnmounting: false,
2102
+ leavingVNodes: /* @__PURE__ */ new Map()
2103
+ };
2104
+ onMounted(() => {
2105
+ state.isMounted = true;
2106
+ });
2107
+ onBeforeUnmount(() => {
2108
+ state.isUnmounting = true;
2109
+ });
2110
+ return state;
2111
+ }
2112
+ const TransitionHookValidator = [Function, Array];
2113
+ const BaseTransitionPropsValidators = {
2114
+ mode: String,
2115
+ appear: Boolean,
2116
+ persisted: Boolean,
2117
+ // enter
2118
+ onBeforeEnter: TransitionHookValidator,
2119
+ onEnter: TransitionHookValidator,
2120
+ onAfterEnter: TransitionHookValidator,
2121
+ onEnterCancelled: TransitionHookValidator,
2122
+ // leave
2123
+ onBeforeLeave: TransitionHookValidator,
2124
+ onLeave: TransitionHookValidator,
2125
+ onAfterLeave: TransitionHookValidator,
2126
+ onLeaveCancelled: TransitionHookValidator,
2127
+ // appear
2128
+ onBeforeAppear: TransitionHookValidator,
2129
+ onAppear: TransitionHookValidator,
2130
+ onAfterAppear: TransitionHookValidator,
2131
+ onAppearCancelled: TransitionHookValidator
2243
2132
  };
2244
- function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2245
- const { props: prevProps, children: prevChildren, component } = prevVNode;
2246
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
2247
- const emits = component.emitsOptions;
2248
- if (nextVNode.dirs || nextVNode.transition) {
2249
- return true;
2250
- }
2251
- if (optimized && patchFlag >= 0) {
2252
- if (patchFlag & 1024) {
2253
- return true;
2254
- }
2255
- if (patchFlag & 16) {
2256
- if (!prevProps) {
2257
- return !!nextProps;
2133
+ const recursiveGetSubtree = (instance) => {
2134
+ const subTree = instance.subTree;
2135
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
2136
+ };
2137
+ const BaseTransitionImpl = {
2138
+ name: `BaseTransition`,
2139
+ props: BaseTransitionPropsValidators,
2140
+ setup(props, { slots }) {
2141
+ const instance = getCurrentInstance();
2142
+ const state = useTransitionState();
2143
+ return () => {
2144
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
2145
+ if (!children || !children.length) {
2146
+ return;
2258
2147
  }
2259
- return hasPropsChanged(prevProps, nextProps, emits);
2260
- } else if (patchFlag & 8) {
2261
- const dynamicProps = nextVNode.dynamicProps;
2262
- for (let i = 0; i < dynamicProps.length; i++) {
2263
- const key = dynamicProps[i];
2264
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
2265
- return true;
2148
+ let child = children[0];
2149
+ if (children.length > 1) {
2150
+ for (const c of children) {
2151
+ if (c.type !== Comment) {
2152
+ child = c;
2153
+ break;
2154
+ }
2266
2155
  }
2267
2156
  }
2268
- }
2269
- } else {
2270
- if (prevChildren || nextChildren) {
2271
- if (!nextChildren || !nextChildren.$stable) {
2272
- return true;
2157
+ const rawProps = toRaw(props);
2158
+ const { mode } = rawProps;
2159
+ if (state.isLeaving) {
2160
+ return emptyPlaceholder(child);
2273
2161
  }
2274
- }
2275
- if (prevProps === nextProps) {
2276
- return false;
2277
- }
2278
- if (!prevProps) {
2279
- return !!nextProps;
2280
- }
2281
- if (!nextProps) {
2282
- return true;
2283
- }
2284
- return hasPropsChanged(prevProps, nextProps, emits);
2162
+ const innerChild = getKeepAliveChild(child);
2163
+ if (!innerChild) {
2164
+ return emptyPlaceholder(child);
2165
+ }
2166
+ let enterHooks = resolveTransitionHooks(
2167
+ innerChild,
2168
+ rawProps,
2169
+ state,
2170
+ instance,
2171
+ // #11061, ensure enterHooks is fresh after clone
2172
+ (hooks) => enterHooks = hooks
2173
+ );
2174
+ setTransitionHooks(innerChild, enterHooks);
2175
+ const oldChild = instance.subTree;
2176
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2177
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
2178
+ const leavingHooks = resolveTransitionHooks(
2179
+ oldInnerChild,
2180
+ rawProps,
2181
+ state,
2182
+ instance
2183
+ );
2184
+ setTransitionHooks(oldInnerChild, leavingHooks);
2185
+ if (mode === "out-in" && innerChild.type !== Comment) {
2186
+ state.isLeaving = true;
2187
+ leavingHooks.afterLeave = () => {
2188
+ state.isLeaving = false;
2189
+ if (instance.update.active !== false) {
2190
+ instance.effect.dirty = true;
2191
+ instance.update();
2192
+ }
2193
+ };
2194
+ return emptyPlaceholder(child);
2195
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
2196
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2197
+ const leavingVNodesCache = getLeavingNodesForType(
2198
+ state,
2199
+ oldInnerChild
2200
+ );
2201
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2202
+ el[leaveCbKey] = () => {
2203
+ earlyRemove();
2204
+ el[leaveCbKey] = void 0;
2205
+ delete enterHooks.delayedLeave;
2206
+ };
2207
+ enterHooks.delayedLeave = delayedLeave;
2208
+ };
2209
+ }
2210
+ }
2211
+ return child;
2212
+ };
2285
2213
  }
2286
- return false;
2214
+ };
2215
+ {
2216
+ BaseTransitionImpl.__isBuiltIn = true;
2287
2217
  }
2288
- function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2289
- const nextKeys = Object.keys(nextProps);
2290
- if (nextKeys.length !== Object.keys(prevProps).length) {
2291
- return true;
2292
- }
2293
- for (let i = 0; i < nextKeys.length; i++) {
2294
- const key = nextKeys[i];
2295
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
2296
- return true;
2297
- }
2218
+ const BaseTransition = BaseTransitionImpl;
2219
+ function getLeavingNodesForType(state, vnode) {
2220
+ const { leavingVNodes } = state;
2221
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
2222
+ if (!leavingVNodesCache) {
2223
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2224
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
2298
2225
  }
2299
- return false;
2226
+ return leavingVNodesCache;
2300
2227
  }
2301
- function updateHOCHostEl({ vnode, parent }, el) {
2302
- while (parent) {
2303
- const root = parent.subTree;
2304
- if (root.suspense && root.suspense.activeBranch === vnode) {
2305
- root.el = vnode.el;
2306
- }
2307
- if (root === vnode) {
2308
- (vnode = parent.vnode).el = el;
2309
- parent = parent.parent;
2310
- } else {
2311
- break;
2312
- }
2228
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
2229
+ const {
2230
+ appear,
2231
+ mode,
2232
+ persisted = false,
2233
+ onBeforeEnter,
2234
+ onEnter,
2235
+ onAfterEnter,
2236
+ onEnterCancelled,
2237
+ onBeforeLeave,
2238
+ onLeave,
2239
+ onAfterLeave,
2240
+ onLeaveCancelled,
2241
+ onBeforeAppear,
2242
+ onAppear,
2243
+ onAfterAppear,
2244
+ onAppearCancelled
2245
+ } = props;
2246
+ const key = String(vnode.key);
2247
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2248
+ const callHook = (hook, args) => {
2249
+ hook && callWithAsyncErrorHandling(
2250
+ hook,
2251
+ instance,
2252
+ 9,
2253
+ args
2254
+ );
2255
+ };
2256
+ const callAsyncHook = (hook, args) => {
2257
+ const done = args[1];
2258
+ callHook(hook, args);
2259
+ if (isArray(hook)) {
2260
+ if (hook.every((hook2) => hook2.length <= 1)) done();
2261
+ } else if (hook.length <= 1) {
2262
+ done();
2263
+ }
2264
+ };
2265
+ const hooks = {
2266
+ mode,
2267
+ persisted,
2268
+ beforeEnter(el) {
2269
+ let hook = onBeforeEnter;
2270
+ if (!state.isMounted) {
2271
+ if (appear) {
2272
+ hook = onBeforeAppear || onBeforeEnter;
2273
+ } else {
2274
+ return;
2275
+ }
2276
+ }
2277
+ if (el[leaveCbKey]) {
2278
+ el[leaveCbKey](
2279
+ true
2280
+ /* cancelled */
2281
+ );
2282
+ }
2283
+ const leavingVNode = leavingVNodesCache[key];
2284
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
2285
+ leavingVNode.el[leaveCbKey]();
2286
+ }
2287
+ callHook(hook, [el]);
2288
+ },
2289
+ enter(el) {
2290
+ let hook = onEnter;
2291
+ let afterHook = onAfterEnter;
2292
+ let cancelHook = onEnterCancelled;
2293
+ if (!state.isMounted) {
2294
+ if (appear) {
2295
+ hook = onAppear || onEnter;
2296
+ afterHook = onAfterAppear || onAfterEnter;
2297
+ cancelHook = onAppearCancelled || onEnterCancelled;
2298
+ } else {
2299
+ return;
2300
+ }
2301
+ }
2302
+ let called = false;
2303
+ const done = el[enterCbKey$1] = (cancelled) => {
2304
+ if (called) return;
2305
+ called = true;
2306
+ if (cancelled) {
2307
+ callHook(cancelHook, [el]);
2308
+ } else {
2309
+ callHook(afterHook, [el]);
2310
+ }
2311
+ if (hooks.delayedLeave) {
2312
+ hooks.delayedLeave();
2313
+ }
2314
+ el[enterCbKey$1] = void 0;
2315
+ };
2316
+ if (hook) {
2317
+ callAsyncHook(hook, [el, done]);
2318
+ } else {
2319
+ done();
2320
+ }
2321
+ },
2322
+ leave(el, remove) {
2323
+ const key2 = String(vnode.key);
2324
+ if (el[enterCbKey$1]) {
2325
+ el[enterCbKey$1](
2326
+ true
2327
+ /* cancelled */
2328
+ );
2329
+ }
2330
+ if (state.isUnmounting) {
2331
+ return remove();
2332
+ }
2333
+ callHook(onBeforeLeave, [el]);
2334
+ let called = false;
2335
+ const done = el[leaveCbKey] = (cancelled) => {
2336
+ if (called) return;
2337
+ called = true;
2338
+ remove();
2339
+ if (cancelled) {
2340
+ callHook(onLeaveCancelled, [el]);
2341
+ } else {
2342
+ callHook(onAfterLeave, [el]);
2343
+ }
2344
+ el[leaveCbKey] = void 0;
2345
+ if (leavingVNodesCache[key2] === vnode) {
2346
+ delete leavingVNodesCache[key2];
2347
+ }
2348
+ };
2349
+ leavingVNodesCache[key2] = vnode;
2350
+ if (onLeave) {
2351
+ callAsyncHook(onLeave, [el, done]);
2352
+ } else {
2353
+ done();
2354
+ }
2355
+ },
2356
+ clone(vnode2) {
2357
+ const hooks2 = resolveTransitionHooks(
2358
+ vnode2,
2359
+ props,
2360
+ state,
2361
+ instance,
2362
+ postClone
2363
+ );
2364
+ if (postClone) postClone(hooks2);
2365
+ return hooks2;
2366
+ }
2367
+ };
2368
+ return hooks;
2369
+ }
2370
+ function emptyPlaceholder(vnode) {
2371
+ if (isKeepAlive(vnode)) {
2372
+ vnode = cloneVNode(vnode);
2373
+ vnode.children = null;
2374
+ return vnode;
2313
2375
  }
2314
2376
  }
2315
-
2316
- const COMPONENTS = "components";
2317
- const DIRECTIVES = "directives";
2318
- const FILTERS = "filters";
2319
- function resolveComponent(name, maybeSelfReference) {
2320
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2377
+ function getKeepAliveChild(vnode) {
2378
+ if (!isKeepAlive(vnode)) {
2379
+ return vnode;
2380
+ }
2381
+ const { shapeFlag, children } = vnode;
2382
+ if (children) {
2383
+ if (shapeFlag & 16) {
2384
+ return children[0];
2385
+ }
2386
+ if (shapeFlag & 32 && isFunction(children.default)) {
2387
+ return children.default();
2388
+ }
2389
+ }
2321
2390
  }
2322
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2323
- function resolveDynamicComponent(component) {
2324
- if (isString(component)) {
2325
- return resolveAsset(COMPONENTS, component, false) || component;
2391
+ function setTransitionHooks(vnode, hooks) {
2392
+ if (vnode.shapeFlag & 6 && vnode.component) {
2393
+ setTransitionHooks(vnode.component.subTree, hooks);
2394
+ } else if (vnode.shapeFlag & 128) {
2395
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2396
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2326
2397
  } else {
2327
- return component || NULL_DYNAMIC_COMPONENT;
2398
+ vnode.transition = hooks;
2328
2399
  }
2329
2400
  }
2330
- function resolveDirective(name) {
2331
- return resolveAsset(DIRECTIVES, name);
2332
- }
2333
- function resolveFilter$1(name) {
2334
- return resolveAsset(FILTERS, name);
2335
- }
2336
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2337
- const instance = currentRenderingInstance || currentInstance;
2338
- if (instance) {
2339
- const Component = instance.type;
2340
- if (type === COMPONENTS) {
2341
- const selfName = getComponentName(
2342
- Component,
2343
- false
2401
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2402
+ let ret = [];
2403
+ let keyedFragmentCount = 0;
2404
+ for (let i = 0; i < children.length; i++) {
2405
+ let child = children[i];
2406
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2407
+ if (child.type === Fragment) {
2408
+ if (child.patchFlag & 128) keyedFragmentCount++;
2409
+ ret = ret.concat(
2410
+ getTransitionRawChildren(child.children, keepComment, key)
2344
2411
  );
2345
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2346
- return Component;
2347
- }
2412
+ } else if (keepComment || child.type !== Comment) {
2413
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2348
2414
  }
2349
- const res = (
2350
- // local registration
2351
- // check instance[type] first which is resolved for options API
2352
- resolve(instance[type] || Component[type], name) || // global registration
2353
- resolve(instance.appContext[type], name)
2354
- );
2355
- if (!res && maybeSelfReference) {
2356
- return Component;
2415
+ }
2416
+ if (keyedFragmentCount > 1) {
2417
+ for (let i = 0; i < ret.length; i++) {
2418
+ ret[i].patchFlag = -2;
2357
2419
  }
2358
- return res;
2359
2420
  }
2421
+ return ret;
2360
2422
  }
2361
- function resolve(registry, name) {
2362
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2423
+
2424
+ /*! #__NO_SIDE_EFFECTS__ */
2425
+ // @__NO_SIDE_EFFECTS__
2426
+ function defineComponent(options, extraOptions) {
2427
+ return isFunction(options) ? (
2428
+ // #8326: extend call and options.name access are considered side-effects
2429
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2430
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
2431
+ ) : options;
2363
2432
  }
2364
2433
 
2365
- const isSuspense = (type) => type.__isSuspense;
2366
- let suspenseId = 0;
2367
- const SuspenseImpl = {
2368
- name: "Suspense",
2369
- // In order to make Suspense tree-shakable, we need to avoid importing it
2370
- // directly in the renderer. The renderer checks for the __isSuspense flag
2371
- // on a vnode's type and calls the `process` method, passing in renderer
2372
- // internals.
2373
- __isSuspense: true,
2374
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2375
- if (n1 == null) {
2376
- mountSuspense(
2377
- n2,
2378
- container,
2379
- anchor,
2380
- parentComponent,
2381
- parentSuspense,
2382
- namespace,
2383
- slotScopeIds,
2384
- optimized,
2385
- rendererInternals
2386
- );
2387
- } else {
2388
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2389
- n2.suspense = n1.suspense;
2390
- n2.suspense.vnode = n2;
2391
- n2.el = n1.el;
2392
- return;
2393
- }
2394
- patchSuspense(
2395
- n1,
2396
- n2,
2397
- container,
2398
- anchor,
2399
- parentComponent,
2400
- namespace,
2401
- slotScopeIds,
2402
- optimized,
2403
- rendererInternals
2404
- );
2405
- }
2406
- },
2407
- hydrate: hydrateSuspense,
2408
- normalize: normalizeSuspenseChildren
2409
- };
2410
- const Suspense = SuspenseImpl ;
2411
- function triggerEvent(vnode, name) {
2412
- const eventListener = vnode.props && vnode.props[name];
2413
- if (isFunction(eventListener)) {
2414
- eventListener();
2434
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2435
+ /*! #__NO_SIDE_EFFECTS__ */
2436
+ // @__NO_SIDE_EFFECTS__
2437
+ function defineAsyncComponent(source) {
2438
+ if (isFunction(source)) {
2439
+ source = { loader: source };
2415
2440
  }
2416
- }
2417
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2418
2441
  const {
2419
- p: patch,
2420
- o: { createElement }
2421
- } = rendererInternals;
2422
- const hiddenContainer = createElement("div");
2423
- const suspense = vnode.suspense = createSuspenseBoundary(
2424
- vnode,
2425
- parentSuspense,
2426
- parentComponent,
2427
- container,
2428
- hiddenContainer,
2429
- anchor,
2430
- namespace,
2431
- slotScopeIds,
2432
- optimized,
2433
- rendererInternals
2434
- );
2435
- patch(
2436
- null,
2437
- suspense.pendingBranch = vnode.ssContent,
2438
- hiddenContainer,
2439
- null,
2440
- parentComponent,
2441
- suspense,
2442
- namespace,
2443
- slotScopeIds
2444
- );
2445
- if (suspense.deps > 0) {
2446
- triggerEvent(vnode, "onPending");
2447
- triggerEvent(vnode, "onFallback");
2448
- patch(
2449
- null,
2450
- vnode.ssFallback,
2451
- container,
2452
- anchor,
2453
- parentComponent,
2454
- null,
2455
- // fallback tree will not have suspense context
2456
- namespace,
2457
- slotScopeIds
2458
- );
2459
- setActiveBranch(suspense, vnode.ssFallback);
2460
- } else {
2461
- suspense.resolve(false, true);
2462
- }
2463
- }
2464
- function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2465
- const suspense = n2.suspense = n1.suspense;
2466
- suspense.vnode = n2;
2467
- n2.el = n1.el;
2468
- const newBranch = n2.ssContent;
2469
- const newFallback = n2.ssFallback;
2470
- const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
2471
- if (pendingBranch) {
2472
- suspense.pendingBranch = newBranch;
2473
- if (isSameVNodeType(newBranch, pendingBranch)) {
2474
- patch(
2475
- pendingBranch,
2476
- newBranch,
2477
- suspense.hiddenContainer,
2478
- null,
2479
- parentComponent,
2480
- suspense,
2481
- namespace,
2482
- slotScopeIds,
2483
- optimized
2484
- );
2485
- if (suspense.deps <= 0) {
2486
- suspense.resolve();
2487
- } else if (isInFallback) {
2488
- if (!isHydrating) {
2489
- patch(
2490
- activeBranch,
2491
- newFallback,
2492
- container,
2493
- anchor,
2494
- parentComponent,
2495
- null,
2496
- // fallback tree will not have suspense context
2497
- namespace,
2498
- slotScopeIds,
2499
- optimized
2500
- );
2501
- setActiveBranch(suspense, newFallback);
2502
- }
2503
- }
2504
- } else {
2505
- suspense.pendingId = suspenseId++;
2506
- if (isHydrating) {
2507
- suspense.isHydrating = false;
2508
- suspense.activeBranch = pendingBranch;
2509
- } else {
2510
- unmount(pendingBranch, parentComponent, suspense);
2511
- }
2512
- suspense.deps = 0;
2513
- suspense.effects.length = 0;
2514
- suspense.hiddenContainer = createElement("div");
2515
- if (isInFallback) {
2516
- patch(
2517
- null,
2518
- newBranch,
2519
- suspense.hiddenContainer,
2520
- null,
2521
- parentComponent,
2522
- suspense,
2523
- namespace,
2524
- slotScopeIds,
2525
- optimized
2526
- );
2527
- if (suspense.deps <= 0) {
2528
- suspense.resolve();
2529
- } else {
2530
- patch(
2531
- activeBranch,
2532
- newFallback,
2533
- container,
2534
- anchor,
2535
- parentComponent,
2536
- null,
2537
- // fallback tree will not have suspense context
2538
- namespace,
2539
- slotScopeIds,
2540
- optimized
2541
- );
2542
- setActiveBranch(suspense, newFallback);
2543
- }
2544
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2545
- patch(
2546
- activeBranch,
2547
- newBranch,
2548
- container,
2549
- anchor,
2550
- parentComponent,
2551
- suspense,
2552
- namespace,
2553
- slotScopeIds,
2554
- optimized
2555
- );
2556
- suspense.resolve(true);
2557
- } else {
2558
- patch(
2559
- null,
2560
- newBranch,
2561
- suspense.hiddenContainer,
2562
- null,
2563
- parentComponent,
2564
- suspense,
2565
- namespace,
2566
- slotScopeIds,
2567
- optimized
2568
- );
2569
- if (suspense.deps <= 0) {
2570
- suspense.resolve();
2571
- }
2572
- }
2573
- }
2574
- } else {
2575
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2576
- patch(
2577
- activeBranch,
2578
- newBranch,
2579
- container,
2580
- anchor,
2581
- parentComponent,
2582
- suspense,
2583
- namespace,
2584
- slotScopeIds,
2585
- optimized
2586
- );
2587
- setActiveBranch(suspense, newBranch);
2588
- } else {
2589
- triggerEvent(n2, "onPending");
2590
- suspense.pendingBranch = newBranch;
2591
- if (newBranch.shapeFlag & 512) {
2592
- suspense.pendingId = newBranch.component.suspenseId;
2593
- } else {
2594
- suspense.pendingId = suspenseId++;
2595
- }
2596
- patch(
2597
- null,
2598
- newBranch,
2599
- suspense.hiddenContainer,
2600
- null,
2601
- parentComponent,
2602
- suspense,
2603
- namespace,
2604
- slotScopeIds,
2605
- optimized
2606
- );
2607
- if (suspense.deps <= 0) {
2608
- suspense.resolve();
2442
+ loader,
2443
+ loadingComponent,
2444
+ errorComponent,
2445
+ delay = 200,
2446
+ timeout,
2447
+ // undefined = never times out
2448
+ suspensible = true,
2449
+ onError: userOnError
2450
+ } = source;
2451
+ let pendingRequest = null;
2452
+ let resolvedComp;
2453
+ let retries = 0;
2454
+ const retry = () => {
2455
+ retries++;
2456
+ pendingRequest = null;
2457
+ return load();
2458
+ };
2459
+ const load = () => {
2460
+ let thisRequest;
2461
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2462
+ err = err instanceof Error ? err : new Error(String(err));
2463
+ if (userOnError) {
2464
+ return new Promise((resolve, reject) => {
2465
+ const userRetry = () => resolve(retry());
2466
+ const userFail = () => reject(err);
2467
+ userOnError(err, userRetry, userFail, retries + 1);
2468
+ });
2609
2469
  } else {
2610
- const { timeout, pendingId } = suspense;
2611
- if (timeout > 0) {
2612
- setTimeout(() => {
2613
- if (suspense.pendingId === pendingId) {
2614
- suspense.fallback(newFallback);
2615
- }
2616
- }, timeout);
2617
- } else if (timeout === 0) {
2618
- suspense.fallback(newFallback);
2619
- }
2620
- }
2621
- }
2622
- }
2623
- }
2624
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2625
- const {
2626
- p: patch,
2627
- m: move,
2628
- um: unmount,
2629
- n: next,
2630
- o: { parentNode, remove }
2631
- } = rendererInternals;
2632
- let parentSuspenseId;
2633
- const isSuspensible = isVNodeSuspensible(vnode);
2634
- if (isSuspensible) {
2635
- if (parentSuspense && parentSuspense.pendingBranch) {
2636
- parentSuspenseId = parentSuspense.pendingId;
2637
- parentSuspense.deps++;
2638
- }
2639
- }
2640
- const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
2641
- const initialAnchor = anchor;
2642
- const suspense = {
2643
- vnode,
2644
- parent: parentSuspense,
2645
- parentComponent,
2646
- namespace,
2647
- container,
2648
- hiddenContainer,
2649
- deps: 0,
2650
- pendingId: suspenseId++,
2651
- timeout: typeof timeout === "number" ? timeout : -1,
2652
- activeBranch: null,
2653
- pendingBranch: null,
2654
- isInFallback: !isHydrating,
2655
- isHydrating,
2656
- isUnmounted: false,
2657
- effects: [],
2658
- resolve(resume = false, sync = false) {
2659
- const {
2660
- vnode: vnode2,
2661
- activeBranch,
2662
- pendingBranch,
2663
- pendingId,
2664
- effects,
2665
- parentComponent: parentComponent2,
2666
- container: container2
2667
- } = suspense;
2668
- let delayEnter = false;
2669
- if (suspense.isHydrating) {
2670
- suspense.isHydrating = false;
2671
- } else if (!resume) {
2672
- delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2673
- if (delayEnter) {
2674
- activeBranch.transition.afterLeave = () => {
2675
- if (pendingId === suspense.pendingId) {
2676
- move(
2677
- pendingBranch,
2678
- container2,
2679
- anchor === initialAnchor ? next(activeBranch) : anchor,
2680
- 0
2681
- );
2682
- queuePostFlushCb(effects);
2683
- }
2684
- };
2685
- }
2686
- if (activeBranch) {
2687
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
2688
- anchor = next(activeBranch);
2689
- }
2690
- unmount(activeBranch, parentComponent2, suspense, true);
2691
- }
2692
- if (!delayEnter) {
2693
- move(pendingBranch, container2, anchor, 0);
2694
- }
2695
- }
2696
- setActiveBranch(suspense, pendingBranch);
2697
- suspense.pendingBranch = null;
2698
- suspense.isInFallback = false;
2699
- let parent = suspense.parent;
2700
- let hasUnresolvedAncestor = false;
2701
- while (parent) {
2702
- if (parent.pendingBranch) {
2703
- parent.effects.push(...effects);
2704
- hasUnresolvedAncestor = true;
2705
- break;
2706
- }
2707
- parent = parent.parent;
2708
- }
2709
- if (!hasUnresolvedAncestor && !delayEnter) {
2710
- queuePostFlushCb(effects);
2711
- }
2712
- suspense.effects = [];
2713
- if (isSuspensible) {
2714
- if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
2715
- parentSuspense.deps--;
2716
- if (parentSuspense.deps === 0 && !sync) {
2717
- parentSuspense.resolve();
2718
- }
2719
- }
2720
- }
2721
- triggerEvent(vnode2, "onResolve");
2722
- },
2723
- fallback(fallbackVNode) {
2724
- if (!suspense.pendingBranch) {
2725
- return;
2726
- }
2727
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
2728
- triggerEvent(vnode2, "onFallback");
2729
- const anchor2 = next(activeBranch);
2730
- const mountFallback = () => {
2731
- if (!suspense.isInFallback) {
2732
- return;
2733
- }
2734
- patch(
2735
- null,
2736
- fallbackVNode,
2737
- container2,
2738
- anchor2,
2739
- parentComponent2,
2740
- null,
2741
- // fallback tree will not have suspense context
2742
- namespace2,
2743
- slotScopeIds,
2744
- optimized
2745
- );
2746
- setActiveBranch(suspense, fallbackVNode);
2747
- };
2748
- const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
2749
- if (delayEnter) {
2750
- activeBranch.transition.afterLeave = mountFallback;
2751
- }
2752
- suspense.isInFallback = true;
2753
- unmount(
2754
- activeBranch,
2755
- parentComponent2,
2756
- null,
2757
- // no suspense so unmount hooks fire now
2758
- true
2759
- // shouldRemove
2760
- );
2761
- if (!delayEnter) {
2762
- mountFallback();
2470
+ throw err;
2763
2471
  }
2764
- },
2765
- move(container2, anchor2, type) {
2766
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
2767
- suspense.container = container2;
2768
- },
2769
- next() {
2770
- return suspense.activeBranch && next(suspense.activeBranch);
2771
- },
2772
- registerDep(instance, setupRenderEffect, optimized2) {
2773
- const isInPendingSuspense = !!suspense.pendingBranch;
2774
- if (isInPendingSuspense) {
2775
- suspense.deps++;
2472
+ }).then((comp) => {
2473
+ if (thisRequest !== pendingRequest && pendingRequest) {
2474
+ return pendingRequest;
2776
2475
  }
2777
- const hydratedEl = instance.vnode.el;
2778
- instance.asyncDep.catch((err) => {
2779
- handleError(err, instance, 0);
2780
- }).then((asyncSetupResult) => {
2781
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
2782
- return;
2783
- }
2784
- instance.asyncResolved = true;
2785
- const { vnode: vnode2 } = instance;
2786
- handleSetupResult(instance, asyncSetupResult, false);
2787
- if (hydratedEl) {
2788
- vnode2.el = hydratedEl;
2789
- }
2790
- const placeholder = !hydratedEl && instance.subTree.el;
2791
- setupRenderEffect(
2792
- instance,
2793
- vnode2,
2794
- // component may have been moved before resolve.
2795
- // if this is not a hydration, instance.subTree will be the comment
2796
- // placeholder.
2797
- parentNode(hydratedEl || instance.subTree.el),
2798
- // anchor will not be used if this is hydration, so only need to
2799
- // consider the comment placeholder case.
2800
- hydratedEl ? null : next(instance.subTree),
2801
- suspense,
2802
- namespace,
2803
- optimized2
2804
- );
2805
- if (placeholder) {
2806
- remove(placeholder);
2807
- }
2808
- updateHOCHostEl(instance, vnode2.el);
2809
- if (isInPendingSuspense && --suspense.deps === 0) {
2810
- suspense.resolve();
2811
- }
2812
- });
2476
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2477
+ comp = comp.default;
2478
+ }
2479
+ resolvedComp = comp;
2480
+ return comp;
2481
+ }));
2482
+ };
2483
+ return defineComponent({
2484
+ name: "AsyncComponentWrapper",
2485
+ __asyncLoader: load,
2486
+ get __asyncResolved() {
2487
+ return resolvedComp;
2813
2488
  },
2814
- unmount(parentSuspense2, doRemove) {
2815
- suspense.isUnmounted = true;
2816
- if (suspense.activeBranch) {
2817
- unmount(
2818
- suspense.activeBranch,
2819
- parentComponent,
2820
- parentSuspense2,
2821
- doRemove
2822
- );
2489
+ setup() {
2490
+ const instance = currentInstance;
2491
+ if (resolvedComp) {
2492
+ return () => createInnerComp(resolvedComp, instance);
2823
2493
  }
2824
- if (suspense.pendingBranch) {
2825
- unmount(
2826
- suspense.pendingBranch,
2827
- parentComponent,
2828
- parentSuspense2,
2829
- doRemove
2494
+ const onError = (err) => {
2495
+ pendingRequest = null;
2496
+ handleError(
2497
+ err,
2498
+ instance,
2499
+ 13,
2500
+ !errorComponent
2830
2501
  );
2502
+ };
2503
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
2504
+ return load().then((comp) => {
2505
+ return () => createInnerComp(comp, instance);
2506
+ }).catch((err) => {
2507
+ onError(err);
2508
+ return () => errorComponent ? createVNode(errorComponent, {
2509
+ error: err
2510
+ }) : null;
2511
+ });
2831
2512
  }
2513
+ const loaded = ref(false);
2514
+ const error = ref();
2515
+ const delayed = ref(!!delay);
2516
+ if (delay) {
2517
+ setTimeout(() => {
2518
+ delayed.value = false;
2519
+ }, delay);
2520
+ }
2521
+ if (timeout != null) {
2522
+ setTimeout(() => {
2523
+ if (!loaded.value && !error.value) {
2524
+ const err = new Error(
2525
+ `Async component timed out after ${timeout}ms.`
2526
+ );
2527
+ onError(err);
2528
+ error.value = err;
2529
+ }
2530
+ }, timeout);
2531
+ }
2532
+ load().then(() => {
2533
+ loaded.value = true;
2534
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2535
+ instance.parent.effect.dirty = true;
2536
+ queueJob(instance.parent.update);
2537
+ }
2538
+ }).catch((err) => {
2539
+ onError(err);
2540
+ error.value = err;
2541
+ });
2542
+ return () => {
2543
+ if (loaded.value && resolvedComp) {
2544
+ return createInnerComp(resolvedComp, instance);
2545
+ } else if (error.value && errorComponent) {
2546
+ return createVNode(errorComponent, {
2547
+ error: error.value
2548
+ });
2549
+ } else if (loadingComponent && !delayed.value) {
2550
+ return createVNode(loadingComponent);
2551
+ }
2552
+ };
2832
2553
  }
2833
- };
2834
- return suspense;
2835
- }
2836
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
2837
- const suspense = vnode.suspense = createSuspenseBoundary(
2838
- vnode,
2839
- parentSuspense,
2840
- parentComponent,
2841
- node.parentNode,
2842
- // eslint-disable-next-line no-restricted-globals
2843
- document.createElement("div"),
2844
- null,
2845
- namespace,
2846
- slotScopeIds,
2847
- optimized,
2848
- rendererInternals,
2849
- true
2850
- );
2851
- const result = hydrateNode(
2852
- node,
2853
- suspense.pendingBranch = vnode.ssContent,
2854
- parentComponent,
2855
- suspense,
2856
- slotScopeIds,
2857
- optimized
2858
- );
2859
- if (suspense.deps === 0) {
2860
- suspense.resolve(false, true);
2861
- }
2862
- return result;
2863
- }
2864
- function normalizeSuspenseChildren(vnode) {
2865
- const { shapeFlag, children } = vnode;
2866
- const isSlotChildren = shapeFlag & 32;
2867
- vnode.ssContent = normalizeSuspenseSlot(
2868
- isSlotChildren ? children.default : children
2869
- );
2870
- vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
2871
- }
2872
- function normalizeSuspenseSlot(s) {
2873
- let block;
2874
- if (isFunction(s)) {
2875
- const trackBlock = isBlockTreeEnabled && s._c;
2876
- if (trackBlock) {
2877
- s._d = false;
2878
- openBlock();
2879
- }
2880
- s = s();
2881
- if (trackBlock) {
2882
- s._d = true;
2883
- block = currentBlock;
2884
- closeBlock();
2885
- }
2886
- }
2887
- if (isArray(s)) {
2888
- const singleChild = filterSingleRoot(s);
2889
- s = singleChild;
2890
- }
2891
- s = normalizeVNode(s);
2892
- if (block && !s.dynamicChildren) {
2893
- s.dynamicChildren = block.filter((c) => c !== s);
2894
- }
2895
- return s;
2896
- }
2897
- function queueEffectWithSuspense(fn, suspense) {
2898
- if (suspense && suspense.pendingBranch) {
2899
- if (isArray(fn)) {
2900
- suspense.effects.push(...fn);
2901
- } else {
2902
- suspense.effects.push(fn);
2903
- }
2904
- } else {
2905
- queuePostFlushCb(fn);
2906
- }
2907
- }
2908
- function setActiveBranch(suspense, branch) {
2909
- suspense.activeBranch = branch;
2910
- const { vnode, parentComponent } = suspense;
2911
- let el = branch.el;
2912
- while (!el && branch.component) {
2913
- branch = branch.component.subTree;
2914
- el = branch.el;
2915
- }
2916
- vnode.el = el;
2917
- if (parentComponent && parentComponent.subTree === vnode) {
2918
- parentComponent.vnode.el = el;
2919
- updateHOCHostEl(parentComponent, el);
2920
- }
2554
+ });
2921
2555
  }
2922
- function isVNodeSuspensible(vnode) {
2923
- const suspensible = vnode.props && vnode.props.suspensible;
2924
- return suspensible != null && suspensible !== false;
2556
+ function createInnerComp(comp, parent) {
2557
+ const { ref: ref2, props, children, ce } = parent.vnode;
2558
+ const vnode = createVNode(comp, props, children);
2559
+ vnode.ref = ref2;
2560
+ vnode.ce = ce;
2561
+ delete parent.vnode.ce;
2562
+ return vnode;
2925
2563
  }
2926
2564
 
2927
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2928
- if (target) {
2929
- const hooks = target[type] || (target[type] = []);
2930
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2931
- pauseTracking();
2932
- const reset = setCurrentInstance(target);
2933
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2934
- reset();
2935
- resetTracking();
2936
- return res;
2937
- });
2938
- if (prepend) {
2939
- hooks.unshift(wrappedHook);
2940
- } else {
2941
- hooks.push(wrappedHook);
2565
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2566
+ const KeepAliveImpl = {
2567
+ name: `KeepAlive`,
2568
+ // Marker for special handling inside the renderer. We are not using a ===
2569
+ // check directly on KeepAlive in the renderer, because importing it directly
2570
+ // would prevent it from being tree-shaken.
2571
+ __isKeepAlive: true,
2572
+ props: {
2573
+ include: [String, RegExp, Array],
2574
+ exclude: [String, RegExp, Array],
2575
+ max: [String, Number]
2576
+ },
2577
+ setup(props, { slots }) {
2578
+ const instance = getCurrentInstance();
2579
+ const sharedContext = instance.ctx;
2580
+ if (!sharedContext.renderer) {
2581
+ return () => {
2582
+ const children = slots.default && slots.default();
2583
+ return children && children.length === 1 ? children[0] : children;
2584
+ };
2585
+ }
2586
+ const cache = /* @__PURE__ */ new Map();
2587
+ const keys = /* @__PURE__ */ new Set();
2588
+ let current = null;
2589
+ const parentSuspense = instance.suspense;
2590
+ const {
2591
+ renderer: {
2592
+ p: patch,
2593
+ m: move,
2594
+ um: _unmount,
2595
+ o: { createElement }
2596
+ }
2597
+ } = sharedContext;
2598
+ const storageContainer = createElement("div");
2599
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2600
+ const instance2 = vnode.component;
2601
+ move(vnode, container, anchor, 0, parentSuspense);
2602
+ patch(
2603
+ instance2.vnode,
2604
+ vnode,
2605
+ container,
2606
+ anchor,
2607
+ instance2,
2608
+ parentSuspense,
2609
+ namespace,
2610
+ vnode.slotScopeIds,
2611
+ optimized
2612
+ );
2613
+ queuePostRenderEffect(() => {
2614
+ instance2.isDeactivated = false;
2615
+ if (instance2.a) {
2616
+ invokeArrayFns(instance2.a);
2617
+ }
2618
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2619
+ if (vnodeHook) {
2620
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2621
+ }
2622
+ }, parentSuspense);
2623
+ };
2624
+ sharedContext.deactivate = (vnode) => {
2625
+ const instance2 = vnode.component;
2626
+ invalidateMount(instance2.m);
2627
+ invalidateMount(instance2.a);
2628
+ move(vnode, storageContainer, null, 1, parentSuspense);
2629
+ queuePostRenderEffect(() => {
2630
+ if (instance2.da) {
2631
+ invokeArrayFns(instance2.da);
2632
+ }
2633
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2634
+ if (vnodeHook) {
2635
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2636
+ }
2637
+ instance2.isDeactivated = true;
2638
+ }, parentSuspense);
2639
+ };
2640
+ function unmount(vnode) {
2641
+ resetShapeFlag(vnode);
2642
+ _unmount(vnode, instance, parentSuspense, true);
2942
2643
  }
2943
- return wrappedHook;
2944
- }
2945
- }
2946
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
2947
- if (!isInSSRComponentSetup || lifecycle === "sp") {
2948
- injectHook(lifecycle, (...args) => hook(...args), target);
2949
- }
2950
- };
2951
- const onBeforeMount = createHook("bm");
2952
- const onMounted = createHook("m");
2953
- const onBeforeUpdate = createHook("bu");
2954
- const onUpdated = createHook("u");
2955
- const onBeforeUnmount = createHook("bum");
2956
- const onUnmounted = createHook("um");
2957
- const onServerPrefetch = createHook("sp");
2958
- const onRenderTriggered = createHook(
2959
- "rtg"
2960
- );
2961
- const onRenderTracked = createHook(
2962
- "rtc"
2963
- );
2964
- function onErrorCaptured(hook, target = currentInstance) {
2965
- injectHook("ec", hook, target);
2966
- }
2967
-
2968
- const legacyDirectiveHookMap = {
2969
- beforeMount: "bind",
2970
- mounted: "inserted",
2971
- updated: ["update", "componentUpdated"],
2972
- unmounted: "unbind"
2973
- };
2974
- function mapCompatDirectiveHook(name, dir, instance) {
2975
- const mappedName = legacyDirectiveHookMap[name];
2976
- if (mappedName) {
2977
- if (isArray(mappedName)) {
2978
- const hook = [];
2979
- mappedName.forEach((mapped) => {
2980
- const mappedHook = dir[mapped];
2981
- if (mappedHook) {
2982
- softAssertCompatEnabled(
2983
- "CUSTOM_DIR",
2984
- instance,
2985
- mapped,
2986
- name
2987
- );
2988
- hook.push(mappedHook);
2644
+ function pruneCache(filter) {
2645
+ cache.forEach((vnode, key) => {
2646
+ const name = getComponentName(vnode.type);
2647
+ if (name && (!filter || !filter(name))) {
2648
+ pruneCacheEntry(key);
2989
2649
  }
2990
2650
  });
2991
- return hook.length ? hook : void 0;
2992
- } else {
2993
- if (dir[mappedName]) {
2994
- softAssertCompatEnabled(
2995
- "CUSTOM_DIR",
2996
- instance,
2997
- mappedName,
2998
- name
2999
- );
2651
+ }
2652
+ function pruneCacheEntry(key) {
2653
+ const cached = cache.get(key);
2654
+ if (!current || !isSameVNodeType(cached, current)) {
2655
+ unmount(cached);
2656
+ } else if (current) {
2657
+ resetShapeFlag(current);
3000
2658
  }
3001
- return dir[mappedName];
2659
+ cache.delete(key);
2660
+ keys.delete(key);
3002
2661
  }
2662
+ watch(
2663
+ () => [props.include, props.exclude],
2664
+ ([include, exclude]) => {
2665
+ include && pruneCache((name) => matches(include, name));
2666
+ exclude && pruneCache((name) => !matches(exclude, name));
2667
+ },
2668
+ // prune post-render after `current` has been updated
2669
+ { flush: "post", deep: true }
2670
+ );
2671
+ let pendingCacheKey = null;
2672
+ const cacheSubtree = () => {
2673
+ if (pendingCacheKey != null) {
2674
+ if (isSuspense(instance.subTree.type)) {
2675
+ queuePostRenderEffect(() => {
2676
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2677
+ }, instance.subTree.suspense);
2678
+ } else {
2679
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2680
+ }
2681
+ }
2682
+ };
2683
+ onMounted(cacheSubtree);
2684
+ onUpdated(cacheSubtree);
2685
+ onBeforeUnmount(() => {
2686
+ cache.forEach((cached) => {
2687
+ const { subTree, suspense } = instance;
2688
+ const vnode = getInnerChild(subTree);
2689
+ if (cached.type === vnode.type && cached.key === vnode.key) {
2690
+ resetShapeFlag(vnode);
2691
+ const da = vnode.component.da;
2692
+ da && queuePostRenderEffect(da, suspense);
2693
+ return;
2694
+ }
2695
+ unmount(cached);
2696
+ });
2697
+ });
2698
+ return () => {
2699
+ pendingCacheKey = null;
2700
+ if (!slots.default) {
2701
+ return null;
2702
+ }
2703
+ const children = slots.default();
2704
+ const rawVNode = children[0];
2705
+ if (children.length > 1) {
2706
+ current = null;
2707
+ return children;
2708
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2709
+ current = null;
2710
+ return rawVNode;
2711
+ }
2712
+ let vnode = getInnerChild(rawVNode);
2713
+ const comp = vnode.type;
2714
+ const name = getComponentName(
2715
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2716
+ );
2717
+ const { include, exclude, max } = props;
2718
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2719
+ current = vnode;
2720
+ return rawVNode;
2721
+ }
2722
+ const key = vnode.key == null ? comp : vnode.key;
2723
+ const cachedVNode = cache.get(key);
2724
+ if (vnode.el) {
2725
+ vnode = cloneVNode(vnode);
2726
+ if (rawVNode.shapeFlag & 128) {
2727
+ rawVNode.ssContent = vnode;
2728
+ }
2729
+ }
2730
+ pendingCacheKey = key;
2731
+ if (cachedVNode) {
2732
+ vnode.el = cachedVNode.el;
2733
+ vnode.component = cachedVNode.component;
2734
+ if (vnode.transition) {
2735
+ setTransitionHooks(vnode, vnode.transition);
2736
+ }
2737
+ vnode.shapeFlag |= 512;
2738
+ keys.delete(key);
2739
+ keys.add(key);
2740
+ } else {
2741
+ keys.add(key);
2742
+ if (max && keys.size > parseInt(max, 10)) {
2743
+ pruneCacheEntry(keys.values().next().value);
2744
+ }
2745
+ }
2746
+ vnode.shapeFlag |= 256;
2747
+ current = vnode;
2748
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
2749
+ };
3003
2750
  }
2751
+ };
2752
+ {
2753
+ KeepAliveImpl.__isBuildIn = true;
3004
2754
  }
3005
-
3006
- function withDirectives(vnode, directives) {
3007
- if (currentRenderingInstance === null) {
3008
- return vnode;
2755
+ const KeepAlive = KeepAliveImpl;
2756
+ function matches(pattern, name) {
2757
+ if (isArray(pattern)) {
2758
+ return pattern.some((p) => matches(p, name));
2759
+ } else if (isString(pattern)) {
2760
+ return pattern.split(",").includes(name);
2761
+ } else if (isRegExp(pattern)) {
2762
+ return pattern.test(name);
3009
2763
  }
3010
- const instance = getComponentPublicInstance(currentRenderingInstance);
3011
- const bindings = vnode.dirs || (vnode.dirs = []);
3012
- for (let i = 0; i < directives.length; i++) {
3013
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3014
- if (dir) {
3015
- if (isFunction(dir)) {
3016
- dir = {
3017
- mounted: dir,
3018
- updated: dir
3019
- };
2764
+ return false;
2765
+ }
2766
+ function onActivated(hook, target) {
2767
+ registerKeepAliveHook(hook, "a", target);
2768
+ }
2769
+ function onDeactivated(hook, target) {
2770
+ registerKeepAliveHook(hook, "da", target);
2771
+ }
2772
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
2773
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2774
+ let current = target;
2775
+ while (current) {
2776
+ if (current.isDeactivated) {
2777
+ return;
3020
2778
  }
3021
- if (dir.deep) {
3022
- traverse(value);
2779
+ current = current.parent;
2780
+ }
2781
+ return hook();
2782
+ });
2783
+ injectHook(type, wrappedHook, target);
2784
+ if (target) {
2785
+ let current = target.parent;
2786
+ while (current && current.parent) {
2787
+ if (isKeepAlive(current.parent.vnode)) {
2788
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
3023
2789
  }
3024
- bindings.push({
3025
- dir,
3026
- instance,
3027
- value,
3028
- oldValue: void 0,
3029
- arg,
3030
- modifiers
3031
- });
2790
+ current = current.parent;
3032
2791
  }
3033
2792
  }
3034
- return vnode;
3035
2793
  }
3036
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3037
- const bindings = vnode.dirs;
3038
- const oldBindings = prevVNode && prevVNode.dirs;
3039
- for (let i = 0; i < bindings.length; i++) {
3040
- const binding = bindings[i];
3041
- if (oldBindings) {
3042
- binding.oldValue = oldBindings[i].value;
3043
- }
3044
- let hook = binding.dir[name];
3045
- if (!hook) {
3046
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
3047
- }
3048
- if (hook) {
2794
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2795
+ const injected = injectHook(
2796
+ type,
2797
+ hook,
2798
+ keepAliveRoot,
2799
+ true
2800
+ /* prepend */
2801
+ );
2802
+ onUnmounted(() => {
2803
+ remove(keepAliveRoot[type], injected);
2804
+ }, target);
2805
+ }
2806
+ function resetShapeFlag(vnode) {
2807
+ vnode.shapeFlag &= ~256;
2808
+ vnode.shapeFlag &= ~512;
2809
+ }
2810
+ function getInnerChild(vnode) {
2811
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2812
+ }
2813
+
2814
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
2815
+ if (target) {
2816
+ const hooks = target[type] || (target[type] = []);
2817
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
3049
2818
  pauseTracking();
3050
- callWithAsyncErrorHandling(hook, instance, 8, [
3051
- vnode.el,
3052
- binding,
3053
- vnode,
3054
- prevVNode
3055
- ]);
2819
+ const reset = setCurrentInstance(target);
2820
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
2821
+ reset();
3056
2822
  resetTracking();
2823
+ return res;
2824
+ });
2825
+ if (prepend) {
2826
+ hooks.unshift(wrappedHook);
2827
+ } else {
2828
+ hooks.push(wrappedHook);
3057
2829
  }
2830
+ return wrappedHook;
3058
2831
  }
3059
2832
  }
2833
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2834
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
2835
+ injectHook(lifecycle, (...args) => hook(...args), target);
2836
+ }
2837
+ };
2838
+ const onBeforeMount = createHook("bm");
2839
+ const onMounted = createHook("m");
2840
+ const onBeforeUpdate = createHook("bu");
2841
+ const onUpdated = createHook("u");
2842
+ const onBeforeUnmount = createHook("bum");
2843
+ const onUnmounted = createHook("um");
2844
+ const onServerPrefetch = createHook("sp");
2845
+ const onRenderTriggered = createHook(
2846
+ "rtg"
2847
+ );
2848
+ const onRenderTracked = createHook(
2849
+ "rtc"
2850
+ );
2851
+ function onErrorCaptured(hook, target = currentInstance) {
2852
+ injectHook("ec", hook, target);
2853
+ }
3060
2854
 
3061
2855
  function getCompatChildren(instance) {
3062
2856
  assertCompatEnabled("INSTANCE_CHILDREN", instance);
@@ -3093,6 +2887,55 @@ function getCompatListeners(instance) {
3093
2887
  return listeners;
3094
2888
  }
3095
2889
 
2890
+ const COMPONENTS = "components";
2891
+ const DIRECTIVES = "directives";
2892
+ const FILTERS = "filters";
2893
+ function resolveComponent(name, maybeSelfReference) {
2894
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2895
+ }
2896
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2897
+ function resolveDynamicComponent(component) {
2898
+ if (isString(component)) {
2899
+ return resolveAsset(COMPONENTS, component, false) || component;
2900
+ } else {
2901
+ return component || NULL_DYNAMIC_COMPONENT;
2902
+ }
2903
+ }
2904
+ function resolveDirective(name) {
2905
+ return resolveAsset(DIRECTIVES, name);
2906
+ }
2907
+ function resolveFilter$1(name) {
2908
+ return resolveAsset(FILTERS, name);
2909
+ }
2910
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2911
+ const instance = currentRenderingInstance || currentInstance;
2912
+ if (instance) {
2913
+ const Component = instance.type;
2914
+ if (type === COMPONENTS) {
2915
+ const selfName = getComponentName(
2916
+ Component,
2917
+ false
2918
+ );
2919
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2920
+ return Component;
2921
+ }
2922
+ }
2923
+ const res = (
2924
+ // local registration
2925
+ // check instance[type] first which is resolved for options API
2926
+ resolve(instance[type] || Component[type], name) || // global registration
2927
+ resolve(instance.appContext[type], name)
2928
+ );
2929
+ if (!res && maybeSelfReference) {
2930
+ return Component;
2931
+ }
2932
+ return res;
2933
+ }
2934
+ }
2935
+ function resolve(registry, name) {
2936
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2937
+ }
2938
+
3096
2939
  function convertLegacyRenderFn(instance) {
3097
2940
  const Component = instance.type;
3098
2941
  const render = Component.render;
@@ -3395,147 +3238,6 @@ function createSlots(slots, dynamicSlots) {
3395
3238
  return slots;
3396
3239
  }
3397
3240
 
3398
- /*! #__NO_SIDE_EFFECTS__ */
3399
- // @__NO_SIDE_EFFECTS__
3400
- function defineComponent(options, extraOptions) {
3401
- return isFunction(options) ? (
3402
- // #8326: extend call and options.name access are considered side-effects
3403
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3404
- /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3405
- ) : options;
3406
- }
3407
-
3408
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
3409
- /*! #__NO_SIDE_EFFECTS__ */
3410
- // @__NO_SIDE_EFFECTS__
3411
- function defineAsyncComponent(source) {
3412
- if (isFunction(source)) {
3413
- source = { loader: source };
3414
- }
3415
- const {
3416
- loader,
3417
- loadingComponent,
3418
- errorComponent,
3419
- delay = 200,
3420
- timeout,
3421
- // undefined = never times out
3422
- suspensible = true,
3423
- onError: userOnError
3424
- } = source;
3425
- let pendingRequest = null;
3426
- let resolvedComp;
3427
- let retries = 0;
3428
- const retry = () => {
3429
- retries++;
3430
- pendingRequest = null;
3431
- return load();
3432
- };
3433
- const load = () => {
3434
- let thisRequest;
3435
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
3436
- err = err instanceof Error ? err : new Error(String(err));
3437
- if (userOnError) {
3438
- return new Promise((resolve, reject) => {
3439
- const userRetry = () => resolve(retry());
3440
- const userFail = () => reject(err);
3441
- userOnError(err, userRetry, userFail, retries + 1);
3442
- });
3443
- } else {
3444
- throw err;
3445
- }
3446
- }).then((comp) => {
3447
- if (thisRequest !== pendingRequest && pendingRequest) {
3448
- return pendingRequest;
3449
- }
3450
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
3451
- comp = comp.default;
3452
- }
3453
- resolvedComp = comp;
3454
- return comp;
3455
- }));
3456
- };
3457
- return defineComponent({
3458
- name: "AsyncComponentWrapper",
3459
- __asyncLoader: load,
3460
- get __asyncResolved() {
3461
- return resolvedComp;
3462
- },
3463
- setup() {
3464
- const instance = currentInstance;
3465
- if (resolvedComp) {
3466
- return () => createInnerComp(resolvedComp, instance);
3467
- }
3468
- const onError = (err) => {
3469
- pendingRequest = null;
3470
- handleError(
3471
- err,
3472
- instance,
3473
- 13,
3474
- !errorComponent
3475
- );
3476
- };
3477
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
3478
- return load().then((comp) => {
3479
- return () => createInnerComp(comp, instance);
3480
- }).catch((err) => {
3481
- onError(err);
3482
- return () => errorComponent ? createVNode(errorComponent, {
3483
- error: err
3484
- }) : null;
3485
- });
3486
- }
3487
- const loaded = ref(false);
3488
- const error = ref();
3489
- const delayed = ref(!!delay);
3490
- if (delay) {
3491
- setTimeout(() => {
3492
- delayed.value = false;
3493
- }, delay);
3494
- }
3495
- if (timeout != null) {
3496
- setTimeout(() => {
3497
- if (!loaded.value && !error.value) {
3498
- const err = new Error(
3499
- `Async component timed out after ${timeout}ms.`
3500
- );
3501
- onError(err);
3502
- error.value = err;
3503
- }
3504
- }, timeout);
3505
- }
3506
- load().then(() => {
3507
- loaded.value = true;
3508
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
3509
- instance.parent.effect.dirty = true;
3510
- queueJob(instance.parent.update);
3511
- }
3512
- }).catch((err) => {
3513
- onError(err);
3514
- error.value = err;
3515
- });
3516
- return () => {
3517
- if (loaded.value && resolvedComp) {
3518
- return createInnerComp(resolvedComp, instance);
3519
- } else if (error.value && errorComponent) {
3520
- return createVNode(errorComponent, {
3521
- error: error.value
3522
- });
3523
- } else if (loadingComponent && !delayed.value) {
3524
- return createVNode(loadingComponent);
3525
- }
3526
- };
3527
- }
3528
- });
3529
- }
3530
- function createInnerComp(comp, parent) {
3531
- const { ref: ref2, props, children, ce } = parent.vnode;
3532
- const vnode = createVNode(comp, props, children);
3533
- vnode.ref = ref2;
3534
- vnode.ce = ce;
3535
- delete parent.vnode.ce;
3536
- return vnode;
3537
- }
3538
-
3539
3241
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3540
3242
  if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
3541
3243
  if (name !== "default") props.name = name;
@@ -3550,9 +3252,10 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3550
3252
  const rendered = createBlock(
3551
3253
  Fragment,
3552
3254
  {
3553
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
3255
+ key: (props.key || // slot content array of a dynamic conditional slot may have a branch
3554
3256
  // key attached in the `createSlots` helper, respect that
3555
- validSlotContent && validSlotContent.key || `_${name}`
3257
+ validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
3258
+ (!validSlotContent && fallback ? "_fb" : "")
3556
3259
  },
3557
3260
  validSlotContent || (fallback ? fallback() : []),
3558
3261
  validSlotContent && slots._ === 1 ? 64 : -2
@@ -4448,7 +4151,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
4448
4151
  return vm;
4449
4152
  }
4450
4153
  }
4451
- Vue.version = `2.6.14-compat:${"3.4.31"}`;
4154
+ Vue.version = `2.6.14-compat:${"3.4.32"}`;
4452
4155
  Vue.config = singletonApp.config;
4453
4156
  Vue.use = (plugin, ...options) => {
4454
4157
  if (plugin && isFunction(plugin.install)) {
@@ -5187,8 +4890,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5187
4890
  }
5188
4891
  return value;
5189
4892
  }
4893
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
5190
4894
  function normalizePropsOptions(comp, appContext, asMixin = false) {
5191
- const cache = appContext.propsCache;
4895
+ const cache = asMixin ? mixinPropsCache : appContext.propsCache;
5192
4896
  const cached = cache.get(comp);
5193
4897
  if (cached) {
5194
4898
  return cached;
@@ -5314,13 +5018,22 @@ const normalizeVNodeSlots = (instance, children) => {
5314
5018
  const normalized = normalizeSlotValue(children);
5315
5019
  instance.slots.default = () => normalized;
5316
5020
  };
5317
- const initSlots = (instance, children) => {
5021
+ const assignSlots = (slots, children, optimized) => {
5022
+ for (const key in children) {
5023
+ if (optimized || key !== "_") {
5024
+ slots[key] = children[key];
5025
+ }
5026
+ }
5027
+ };
5028
+ const initSlots = (instance, children, optimized) => {
5318
5029
  const slots = instance.slots = createInternalObject();
5319
5030
  if (instance.vnode.shapeFlag & 32) {
5320
5031
  const type = children._;
5321
5032
  if (type) {
5322
- extend(slots, children);
5323
- def(slots, "_", type, true);
5033
+ assignSlots(slots, children, optimized);
5034
+ if (optimized) {
5035
+ def(slots, "_", type, true);
5036
+ }
5324
5037
  } else {
5325
5038
  normalizeObjectSlots(children, slots);
5326
5039
  }
@@ -5338,10 +5051,7 @@ const updateSlots = (instance, children, optimized) => {
5338
5051
  if (optimized && type === 1) {
5339
5052
  needDeletionCheck = false;
5340
5053
  } else {
5341
- extend(slots, children);
5342
- if (!optimized && type === 1) {
5343
- delete slots._;
5344
- }
5054
+ assignSlots(slots, children, optimized);
5345
5055
  }
5346
5056
  } else {
5347
5057
  needDeletionCheck = !children.$stable;
@@ -5389,53 +5099,317 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5389
5099
  if (hasOwn(setupState, oldRef)) {
5390
5100
  setupState[oldRef] = null;
5391
5101
  }
5392
- } else if (isRef(oldRef)) {
5393
- oldRef.value = null;
5102
+ } else if (isRef(oldRef)) {
5103
+ oldRef.value = null;
5104
+ }
5105
+ }
5106
+ if (isFunction(ref)) {
5107
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
5108
+ } else {
5109
+ const _isString = isString(ref);
5110
+ const _isRef = isRef(ref);
5111
+ if (_isString || _isRef) {
5112
+ const doSet = () => {
5113
+ if (rawRef.f) {
5114
+ const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
5115
+ if (isUnmount) {
5116
+ isArray(existing) && remove(existing, refValue);
5117
+ } else {
5118
+ if (!isArray(existing)) {
5119
+ if (_isString) {
5120
+ refs[ref] = [refValue];
5121
+ if (hasOwn(setupState, ref)) {
5122
+ setupState[ref] = refs[ref];
5123
+ }
5124
+ } else {
5125
+ ref.value = [refValue];
5126
+ if (rawRef.k) refs[rawRef.k] = ref.value;
5127
+ }
5128
+ } else if (!existing.includes(refValue)) {
5129
+ existing.push(refValue);
5130
+ }
5131
+ }
5132
+ } else if (_isString) {
5133
+ refs[ref] = value;
5134
+ if (hasOwn(setupState, ref)) {
5135
+ setupState[ref] = value;
5136
+ }
5137
+ } else if (_isRef) {
5138
+ ref.value = value;
5139
+ if (rawRef.k) refs[rawRef.k] = value;
5140
+ } else ;
5141
+ };
5142
+ if (value) {
5143
+ doSet.id = -1;
5144
+ queuePostRenderEffect(doSet, parentSuspense);
5145
+ } else {
5146
+ doSet();
5147
+ }
5148
+ }
5149
+ }
5150
+ }
5151
+
5152
+ const TeleportEndKey = Symbol("_vte");
5153
+ const isTeleport = (type) => type.__isTeleport;
5154
+ const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
5155
+ const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
5156
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
5157
+ const resolveTarget = (props, select) => {
5158
+ const targetSelector = props && props.to;
5159
+ if (isString(targetSelector)) {
5160
+ if (!select) {
5161
+ return null;
5162
+ } else {
5163
+ const target = select(targetSelector);
5164
+ return target;
5165
+ }
5166
+ } else {
5167
+ return targetSelector;
5168
+ }
5169
+ };
5170
+ const TeleportImpl = {
5171
+ name: "Teleport",
5172
+ __isTeleport: true,
5173
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
5174
+ const {
5175
+ mc: mountChildren,
5176
+ pc: patchChildren,
5177
+ pbc: patchBlockChildren,
5178
+ o: { insert, querySelector, createText, createComment }
5179
+ } = internals;
5180
+ const disabled = isTeleportDisabled(n2.props);
5181
+ let { shapeFlag, children, dynamicChildren } = n2;
5182
+ if (n1 == null) {
5183
+ const placeholder = n2.el = createText("");
5184
+ const mainAnchor = n2.anchor = createText("");
5185
+ const target = n2.target = resolveTarget(n2.props, querySelector);
5186
+ const targetStart = n2.targetStart = createText("");
5187
+ const targetAnchor = n2.targetAnchor = createText("");
5188
+ insert(placeholder, container, anchor);
5189
+ insert(mainAnchor, container, anchor);
5190
+ targetStart[TeleportEndKey] = targetAnchor;
5191
+ if (target) {
5192
+ insert(targetStart, target);
5193
+ insert(targetAnchor, target);
5194
+ if (namespace === "svg" || isTargetSVG(target)) {
5195
+ namespace = "svg";
5196
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
5197
+ namespace = "mathml";
5198
+ }
5199
+ }
5200
+ const mount = (container2, anchor2) => {
5201
+ if (shapeFlag & 16) {
5202
+ mountChildren(
5203
+ children,
5204
+ container2,
5205
+ anchor2,
5206
+ parentComponent,
5207
+ parentSuspense,
5208
+ namespace,
5209
+ slotScopeIds,
5210
+ optimized
5211
+ );
5212
+ }
5213
+ };
5214
+ if (disabled) {
5215
+ mount(container, mainAnchor);
5216
+ } else if (target) {
5217
+ mount(target, targetAnchor);
5218
+ }
5219
+ } else {
5220
+ n2.el = n1.el;
5221
+ n2.targetStart = n1.targetStart;
5222
+ const mainAnchor = n2.anchor = n1.anchor;
5223
+ const target = n2.target = n1.target;
5224
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
5225
+ const wasDisabled = isTeleportDisabled(n1.props);
5226
+ const currentContainer = wasDisabled ? container : target;
5227
+ const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
5228
+ if (namespace === "svg" || isTargetSVG(target)) {
5229
+ namespace = "svg";
5230
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
5231
+ namespace = "mathml";
5232
+ }
5233
+ if (dynamicChildren) {
5234
+ patchBlockChildren(
5235
+ n1.dynamicChildren,
5236
+ dynamicChildren,
5237
+ currentContainer,
5238
+ parentComponent,
5239
+ parentSuspense,
5240
+ namespace,
5241
+ slotScopeIds
5242
+ );
5243
+ traverseStaticChildren(n1, n2, true);
5244
+ } else if (!optimized) {
5245
+ patchChildren(
5246
+ n1,
5247
+ n2,
5248
+ currentContainer,
5249
+ currentAnchor,
5250
+ parentComponent,
5251
+ parentSuspense,
5252
+ namespace,
5253
+ slotScopeIds,
5254
+ false
5255
+ );
5256
+ }
5257
+ if (disabled) {
5258
+ if (!wasDisabled) {
5259
+ moveTeleport(
5260
+ n2,
5261
+ container,
5262
+ mainAnchor,
5263
+ internals,
5264
+ 1
5265
+ );
5266
+ } else {
5267
+ if (n2.props && n1.props && n2.props.to !== n1.props.to) {
5268
+ n2.props.to = n1.props.to;
5269
+ }
5270
+ }
5271
+ } else {
5272
+ if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
5273
+ const nextTarget = n2.target = resolveTarget(
5274
+ n2.props,
5275
+ querySelector
5276
+ );
5277
+ if (nextTarget) {
5278
+ moveTeleport(
5279
+ n2,
5280
+ nextTarget,
5281
+ null,
5282
+ internals,
5283
+ 0
5284
+ );
5285
+ }
5286
+ } else if (wasDisabled) {
5287
+ moveTeleport(
5288
+ n2,
5289
+ target,
5290
+ targetAnchor,
5291
+ internals,
5292
+ 1
5293
+ );
5294
+ }
5295
+ }
5296
+ }
5297
+ updateCssVars(n2);
5298
+ },
5299
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
5300
+ const {
5301
+ shapeFlag,
5302
+ children,
5303
+ anchor,
5304
+ targetStart,
5305
+ targetAnchor,
5306
+ target,
5307
+ props
5308
+ } = vnode;
5309
+ if (target) {
5310
+ hostRemove(targetStart);
5311
+ hostRemove(targetAnchor);
5312
+ }
5313
+ doRemove && hostRemove(anchor);
5314
+ if (shapeFlag & 16) {
5315
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
5316
+ for (let i = 0; i < children.length; i++) {
5317
+ const child = children[i];
5318
+ unmount(
5319
+ child,
5320
+ parentComponent,
5321
+ parentSuspense,
5322
+ shouldRemove,
5323
+ !!child.dynamicChildren
5324
+ );
5325
+ }
5326
+ }
5327
+ },
5328
+ move: moveTeleport,
5329
+ hydrate: hydrateTeleport
5330
+ };
5331
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
5332
+ if (moveType === 0) {
5333
+ insert(vnode.targetAnchor, container, parentAnchor);
5334
+ }
5335
+ const { el, anchor, shapeFlag, children, props } = vnode;
5336
+ const isReorder = moveType === 2;
5337
+ if (isReorder) {
5338
+ insert(el, container, parentAnchor);
5339
+ }
5340
+ if (!isReorder || isTeleportDisabled(props)) {
5341
+ if (shapeFlag & 16) {
5342
+ for (let i = 0; i < children.length; i++) {
5343
+ move(
5344
+ children[i],
5345
+ container,
5346
+ parentAnchor,
5347
+ 2
5348
+ );
5349
+ }
5350
+ }
5351
+ }
5352
+ if (isReorder) {
5353
+ insert(anchor, container, parentAnchor);
5354
+ }
5355
+ }
5356
+ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
5357
+ o: { nextSibling, parentNode, querySelector }
5358
+ }, hydrateChildren) {
5359
+ const target = vnode.target = resolveTarget(
5360
+ vnode.props,
5361
+ querySelector
5362
+ );
5363
+ if (target) {
5364
+ const targetNode = target._lpa || target.firstChild;
5365
+ if (vnode.shapeFlag & 16) {
5366
+ if (isTeleportDisabled(vnode.props)) {
5367
+ vnode.anchor = hydrateChildren(
5368
+ nextSibling(node),
5369
+ vnode,
5370
+ parentNode(node),
5371
+ parentComponent,
5372
+ parentSuspense,
5373
+ slotScopeIds,
5374
+ optimized
5375
+ );
5376
+ vnode.targetAnchor = targetNode;
5377
+ } else {
5378
+ vnode.anchor = nextSibling(node);
5379
+ let targetAnchor = targetNode;
5380
+ while (targetAnchor) {
5381
+ targetAnchor = nextSibling(targetAnchor);
5382
+ if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
5383
+ vnode.targetAnchor = targetAnchor;
5384
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5385
+ break;
5386
+ }
5387
+ }
5388
+ hydrateChildren(
5389
+ targetNode,
5390
+ vnode,
5391
+ target,
5392
+ parentComponent,
5393
+ parentSuspense,
5394
+ slotScopeIds,
5395
+ optimized
5396
+ );
5397
+ }
5394
5398
  }
5399
+ updateCssVars(vnode);
5395
5400
  }
5396
- if (isFunction(ref)) {
5397
- callWithErrorHandling(ref, owner, 12, [value, refs]);
5398
- } else {
5399
- const _isString = isString(ref);
5400
- const _isRef = isRef(ref);
5401
- if (_isString || _isRef) {
5402
- const doSet = () => {
5403
- if (rawRef.f) {
5404
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
5405
- if (isUnmount) {
5406
- isArray(existing) && remove(existing, refValue);
5407
- } else {
5408
- if (!isArray(existing)) {
5409
- if (_isString) {
5410
- refs[ref] = [refValue];
5411
- if (hasOwn(setupState, ref)) {
5412
- setupState[ref] = refs[ref];
5413
- }
5414
- } else {
5415
- ref.value = [refValue];
5416
- if (rawRef.k) refs[rawRef.k] = ref.value;
5417
- }
5418
- } else if (!existing.includes(refValue)) {
5419
- existing.push(refValue);
5420
- }
5421
- }
5422
- } else if (_isString) {
5423
- refs[ref] = value;
5424
- if (hasOwn(setupState, ref)) {
5425
- setupState[ref] = value;
5426
- }
5427
- } else if (_isRef) {
5428
- ref.value = value;
5429
- if (rawRef.k) refs[rawRef.k] = value;
5430
- } else ;
5431
- };
5432
- if (value) {
5433
- doSet.id = -1;
5434
- queuePostRenderEffect(doSet, parentSuspense);
5435
- } else {
5436
- doSet();
5437
- }
5401
+ return vnode.anchor && nextSibling(vnode.anchor);
5402
+ }
5403
+ const Teleport = TeleportImpl;
5404
+ function updateCssVars(vnode) {
5405
+ const ctx = vnode.ctx;
5406
+ if (ctx && ctx.ut) {
5407
+ let node = vnode.children[0].el;
5408
+ while (node && node !== vnode.targetAnchor) {
5409
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
5410
+ node = node.nextSibling;
5438
5411
  }
5412
+ ctx.ut();
5439
5413
  }
5440
5414
  }
5441
5415
 
@@ -5689,15 +5663,7 @@ function createHydrationFunctions(rendererInternals) {
5689
5663
  for (const key in props) {
5690
5664
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5691
5665
  key[0] === ".") {
5692
- patchProp(
5693
- el,
5694
- key,
5695
- null,
5696
- props[key],
5697
- void 0,
5698
- void 0,
5699
- parentComponent
5700
- );
5666
+ patchProp(el, key, null, props[key], void 0, parentComponent);
5701
5667
  }
5702
5668
  }
5703
5669
  } else if (props.onClick) {
@@ -5707,9 +5673,10 @@ function createHydrationFunctions(rendererInternals) {
5707
5673
  null,
5708
5674
  props.onClick,
5709
5675
  void 0,
5710
- void 0,
5711
5676
  parentComponent
5712
5677
  );
5678
+ } else if (patchFlag & 4 && isReactive(props.style)) {
5679
+ for (const key in props.style) props.style[key];
5713
5680
  }
5714
5681
  }
5715
5682
  let vnodeHooks;
@@ -5735,7 +5702,21 @@ function createHydrationFunctions(rendererInternals) {
5735
5702
  const l = children.length;
5736
5703
  for (let i = 0; i < l; i++) {
5737
5704
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5705
+ const isText = vnode.type === Text;
5738
5706
  if (node) {
5707
+ if (isText && !optimized) {
5708
+ let next = children[i + 1];
5709
+ if (next && (next = normalizeVNode(next)).type === Text) {
5710
+ insert(
5711
+ createText(
5712
+ node.data.slice(vnode.children.length)
5713
+ ),
5714
+ container,
5715
+ nextSibling(node)
5716
+ );
5717
+ node.data = vnode.children;
5718
+ }
5719
+ }
5739
5720
  node = hydrateNode(
5740
5721
  node,
5741
5722
  vnode,
@@ -5744,7 +5725,7 @@ function createHydrationFunctions(rendererInternals) {
5744
5725
  slotScopeIds,
5745
5726
  optimized
5746
5727
  );
5747
- } else if (vnode.type === Text && !vnode.children) {
5728
+ } else if (isText && !vnode.children) {
5748
5729
  insert(vnode.el = createText(""), container);
5749
5730
  } else {
5750
5731
  logMismatchError();
@@ -6083,17 +6064,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6083
6064
  if (props) {
6084
6065
  for (const key in props) {
6085
6066
  if (key !== "value" && !isReservedProp(key)) {
6086
- hostPatchProp(
6087
- el,
6088
- key,
6089
- null,
6090
- props[key],
6091
- namespace,
6092
- vnode.children,
6093
- parentComponent,
6094
- parentSuspense,
6095
- unmountChildren
6096
- );
6067
+ hostPatchProp(el, key, null, props[key], namespace, parentComponent);
6097
6068
  }
6098
6069
  }
6099
6070
  if ("value" in props) {
@@ -6173,6 +6144,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6173
6144
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6174
6145
  }
6175
6146
  parentComponent && toggleRecurse(parentComponent, true);
6147
+ if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
6148
+ hostSetElementText(el, "");
6149
+ }
6176
6150
  if (dynamicChildren) {
6177
6151
  patchBlockChildren(
6178
6152
  n1.dynamicChildren,
@@ -6198,15 +6172,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6198
6172
  }
6199
6173
  if (patchFlag > 0) {
6200
6174
  if (patchFlag & 16) {
6201
- patchProps(
6202
- el,
6203
- n2,
6204
- oldProps,
6205
- newProps,
6206
- parentComponent,
6207
- parentSuspense,
6208
- namespace
6209
- );
6175
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
6210
6176
  } else {
6211
6177
  if (patchFlag & 2) {
6212
6178
  if (oldProps.class !== newProps.class) {
@@ -6223,17 +6189,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6223
6189
  const prev = oldProps[key];
6224
6190
  const next = newProps[key];
6225
6191
  if (next !== prev || key === "value") {
6226
- hostPatchProp(
6227
- el,
6228
- key,
6229
- prev,
6230
- next,
6231
- namespace,
6232
- n1.children,
6233
- parentComponent,
6234
- parentSuspense,
6235
- unmountChildren
6236
- );
6192
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
6237
6193
  }
6238
6194
  }
6239
6195
  }
@@ -6244,15 +6200,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6244
6200
  }
6245
6201
  }
6246
6202
  } else if (!optimized && dynamicChildren == null) {
6247
- patchProps(
6248
- el,
6249
- n2,
6250
- oldProps,
6251
- newProps,
6252
- parentComponent,
6253
- parentSuspense,
6254
- namespace
6255
- );
6203
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
6256
6204
  }
6257
6205
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
6258
6206
  queuePostRenderEffect(() => {
@@ -6292,7 +6240,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6292
6240
  );
6293
6241
  }
6294
6242
  };
6295
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
6243
+ const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
6296
6244
  if (oldProps !== newProps) {
6297
6245
  if (oldProps !== EMPTY_OBJ) {
6298
6246
  for (const key in oldProps) {
@@ -6303,10 +6251,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6303
6251
  oldProps[key],
6304
6252
  null,
6305
6253
  namespace,
6306
- vnode.children,
6307
- parentComponent,
6308
- parentSuspense,
6309
- unmountChildren
6254
+ parentComponent
6310
6255
  );
6311
6256
  }
6312
6257
  }
@@ -6316,17 +6261,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6316
6261
  const next = newProps[key];
6317
6262
  const prev = oldProps[key];
6318
6263
  if (next !== prev && key !== "value") {
6319
- hostPatchProp(
6320
- el,
6321
- key,
6322
- prev,
6323
- next,
6324
- namespace,
6325
- vnode.children,
6326
- parentComponent,
6327
- parentSuspense,
6328
- unmountChildren
6329
- );
6264
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
6330
6265
  }
6331
6266
  }
6332
6267
  if ("value" in newProps) {
@@ -6437,7 +6372,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6437
6372
  instance.ctx.renderer = internals;
6438
6373
  }
6439
6374
  if (!compatMountInstance) {
6440
- setupComponent(instance);
6375
+ setupComponent(instance, false, optimized);
6441
6376
  }
6442
6377
  if (instance.asyncDep) {
6443
6378
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
@@ -6637,6 +6572,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6637
6572
  effect.run();
6638
6573
  }
6639
6574
  };
6575
+ update.i = instance;
6640
6576
  update.id = instance.uid;
6641
6577
  toggleRecurse(instance, true);
6642
6578
  update();
@@ -6989,7 +6925,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6989
6925
  shapeFlag,
6990
6926
  patchFlag,
6991
6927
  dirs,
6992
- memoIndex
6928
+ cacheIndex
6993
6929
  } = vnode;
6994
6930
  if (patchFlag === -2) {
6995
6931
  optimized = false;
@@ -6997,8 +6933,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6997
6933
  if (ref != null) {
6998
6934
  setRef(ref, null, parentSuspense, vnode, true);
6999
6935
  }
7000
- if (memoIndex != null) {
7001
- parentComponent.renderCache[memoIndex] = void 0;
6936
+ if (cacheIndex != null) {
6937
+ parentComponent.renderCache[cacheIndex] = void 0;
7002
6938
  }
7003
6939
  if (shapeFlag & 256) {
7004
6940
  parentComponent.ctx.deactivate(vnode);
@@ -7028,7 +6964,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7028
6964
  internals,
7029
6965
  doRemove
7030
6966
  );
7031
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
6967
+ } else if (dynamicChildren && // #5154
6968
+ // when v-once is used inside a block, setBlockTracking(-1) marks the
6969
+ // parent block with hasOnce: true
6970
+ // so that it doesn't take the fast path during unmount - otherwise
6971
+ // components nested in v-once are never unmounted.
6972
+ !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
7032
6973
  (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
7033
6974
  unmountChildren(
7034
6975
  dynamicChildren,
@@ -7136,7 +7077,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7136
7077
  if (vnode.shapeFlag & 128) {
7137
7078
  return vnode.suspense.next();
7138
7079
  }
7139
- return hostNextSibling(vnode.anchor || vnode.el);
7080
+ const el = hostNextSibling(vnode.anchor || vnode.el);
7081
+ const teleportEnd = el && el[TeleportEndKey];
7082
+ return teleportEnd ? hostNextSibling(teleportEnd) : el;
7140
7083
  };
7141
7084
  let isFlushing = false;
7142
7085
  const render = (vnode, container, namespace) => {
@@ -7520,833 +7463,953 @@ function traverse(value, depth = Infinity, seen) {
7520
7463
  return value;
7521
7464
  }
7522
7465
 
7523
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
7524
- const KeepAliveImpl = {
7525
- name: `KeepAlive`,
7526
- // Marker for special handling inside the renderer. We are not using a ===
7527
- // check directly on KeepAlive in the renderer, because importing it directly
7528
- // would prevent it from being tree-shaken.
7529
- __isKeepAlive: true,
7530
- props: {
7531
- include: [String, RegExp, Array],
7532
- exclude: [String, RegExp, Array],
7533
- max: [String, Number]
7534
- },
7535
- setup(props, { slots }) {
7536
- const instance = getCurrentInstance();
7537
- const sharedContext = instance.ctx;
7538
- if (!sharedContext.renderer) {
7539
- return () => {
7540
- const children = slots.default && slots.default();
7541
- return children && children.length === 1 ? children[0] : children;
7542
- };
7543
- }
7544
- const cache = /* @__PURE__ */ new Map();
7545
- const keys = /* @__PURE__ */ new Set();
7546
- let current = null;
7547
- const parentSuspense = instance.suspense;
7548
- const {
7549
- renderer: {
7550
- p: patch,
7551
- m: move,
7552
- um: _unmount,
7553
- o: { createElement }
7554
- }
7555
- } = sharedContext;
7556
- const storageContainer = createElement("div");
7557
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
7558
- const instance2 = vnode.component;
7559
- move(vnode, container, anchor, 0, parentSuspense);
7560
- patch(
7561
- instance2.vnode,
7562
- vnode,
7563
- container,
7564
- anchor,
7565
- instance2,
7566
- parentSuspense,
7567
- namespace,
7568
- vnode.slotScopeIds,
7569
- optimized
7570
- );
7571
- queuePostRenderEffect(() => {
7572
- instance2.isDeactivated = false;
7573
- if (instance2.a) {
7574
- invokeArrayFns(instance2.a);
7575
- }
7576
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
7577
- if (vnodeHook) {
7578
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
7579
- }
7580
- }, parentSuspense);
7581
- };
7582
- sharedContext.deactivate = (vnode) => {
7583
- const instance2 = vnode.component;
7584
- invalidateMount(instance2.m);
7585
- invalidateMount(instance2.a);
7586
- move(vnode, storageContainer, null, 1, parentSuspense);
7587
- queuePostRenderEffect(() => {
7588
- if (instance2.da) {
7589
- invokeArrayFns(instance2.da);
7590
- }
7591
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
7592
- if (vnodeHook) {
7593
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
7594
- }
7595
- instance2.isDeactivated = true;
7596
- }, parentSuspense);
7597
- };
7598
- function unmount(vnode) {
7599
- resetShapeFlag(vnode);
7600
- _unmount(vnode, instance, parentSuspense, true);
7601
- }
7602
- function pruneCache(filter) {
7603
- cache.forEach((vnode, key) => {
7604
- const name = getComponentName(vnode.type);
7605
- if (name && (!filter || !filter(name))) {
7606
- pruneCacheEntry(key);
7607
- }
7608
- });
7609
- }
7610
- function pruneCacheEntry(key) {
7611
- const cached = cache.get(key);
7612
- if (!current || !isSameVNodeType(cached, current)) {
7613
- unmount(cached);
7614
- } else if (current) {
7615
- resetShapeFlag(current);
7466
+ function useModel(props, name, options = EMPTY_OBJ) {
7467
+ const i = getCurrentInstance();
7468
+ const camelizedName = camelize(name);
7469
+ const hyphenatedName = hyphenate(name);
7470
+ const modifiers = getModelModifiers(props, name);
7471
+ const res = customRef((track, trigger) => {
7472
+ let localValue;
7473
+ let prevSetValue;
7474
+ let prevEmittedValue;
7475
+ watchSyncEffect(() => {
7476
+ const propValue = props[name];
7477
+ if (hasChanged(localValue, propValue)) {
7478
+ localValue = propValue;
7479
+ trigger();
7616
7480
  }
7617
- cache.delete(key);
7618
- keys.delete(key);
7619
- }
7620
- watch(
7621
- () => [props.include, props.exclude],
7622
- ([include, exclude]) => {
7623
- include && pruneCache((name) => matches(include, name));
7624
- exclude && pruneCache((name) => !matches(exclude, name));
7481
+ });
7482
+ return {
7483
+ get() {
7484
+ track();
7485
+ return options.get ? options.get(localValue) : localValue;
7625
7486
  },
7626
- // prune post-render after `current` has been updated
7627
- { flush: "post", deep: true }
7628
- );
7629
- let pendingCacheKey = null;
7630
- const cacheSubtree = () => {
7631
- if (pendingCacheKey != null) {
7632
- if (isSuspense(instance.subTree.type)) {
7633
- queuePostRenderEffect(() => {
7634
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
7635
- }, instance.subTree.suspense);
7636
- } else {
7637
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
7487
+ set(value) {
7488
+ if (!hasChanged(value, localValue)) {
7489
+ return;
7490
+ }
7491
+ const rawProps = i.vnode.props;
7492
+ if (!(rawProps && // check if parent has passed v-model
7493
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
7494
+ localValue = value;
7495
+ trigger();
7496
+ }
7497
+ const emittedValue = options.set ? options.set(value) : value;
7498
+ i.emit(`update:${name}`, emittedValue);
7499
+ if (value !== emittedValue && value !== prevSetValue && emittedValue === prevEmittedValue) {
7500
+ trigger();
7638
7501
  }
7502
+ prevSetValue = value;
7503
+ prevEmittedValue = emittedValue;
7639
7504
  }
7640
7505
  };
7641
- onMounted(cacheSubtree);
7642
- onUpdated(cacheSubtree);
7643
- onBeforeUnmount(() => {
7644
- cache.forEach((cached) => {
7645
- const { subTree, suspense } = instance;
7646
- const vnode = getInnerChild(subTree);
7647
- if (cached.type === vnode.type && cached.key === vnode.key) {
7648
- resetShapeFlag(vnode);
7649
- const da = vnode.component.da;
7650
- da && queuePostRenderEffect(da, suspense);
7651
- return;
7506
+ });
7507
+ res[Symbol.iterator] = () => {
7508
+ let i2 = 0;
7509
+ return {
7510
+ next() {
7511
+ if (i2 < 2) {
7512
+ return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
7513
+ } else {
7514
+ return { done: true };
7652
7515
  }
7653
- unmount(cached);
7654
- });
7655
- });
7656
- return () => {
7657
- pendingCacheKey = null;
7658
- if (!slots.default) {
7659
- return null;
7660
- }
7661
- const children = slots.default();
7662
- const rawVNode = children[0];
7663
- if (children.length > 1) {
7664
- current = null;
7665
- return children;
7666
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
7667
- current = null;
7668
- return rawVNode;
7669
- }
7670
- let vnode = getInnerChild(rawVNode);
7671
- const comp = vnode.type;
7672
- const name = getComponentName(
7673
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
7674
- );
7675
- const { include, exclude, max } = props;
7676
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
7677
- current = vnode;
7678
- return rawVNode;
7679
7516
  }
7680
- const key = vnode.key == null ? comp : vnode.key;
7681
- const cachedVNode = cache.get(key);
7682
- if (vnode.el) {
7683
- vnode = cloneVNode(vnode);
7684
- if (rawVNode.shapeFlag & 128) {
7685
- rawVNode.ssContent = vnode;
7686
- }
7517
+ };
7518
+ };
7519
+ return res;
7520
+ }
7521
+ const getModelModifiers = (props, modelName) => {
7522
+ return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
7523
+ };
7524
+
7525
+ function emit(instance, event, ...rawArgs) {
7526
+ if (instance.isUnmounted) return;
7527
+ const props = instance.vnode.props || EMPTY_OBJ;
7528
+ let args = rawArgs;
7529
+ const isModelListener = event.startsWith("update:");
7530
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
7531
+ if (modifiers) {
7532
+ if (modifiers.trim) {
7533
+ args = rawArgs.map((a) => isString(a) ? a.trim() : a);
7534
+ }
7535
+ if (modifiers.number) {
7536
+ args = rawArgs.map(looseToNumber);
7537
+ }
7538
+ }
7539
+ let handlerName;
7540
+ let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
7541
+ props[handlerName = toHandlerKey(camelize(event))];
7542
+ if (!handler && isModelListener) {
7543
+ handler = props[handlerName = toHandlerKey(hyphenate(event))];
7544
+ }
7545
+ if (handler) {
7546
+ callWithAsyncErrorHandling(
7547
+ handler,
7548
+ instance,
7549
+ 6,
7550
+ args
7551
+ );
7552
+ }
7553
+ const onceHandler = props[handlerName + `Once`];
7554
+ if (onceHandler) {
7555
+ if (!instance.emitted) {
7556
+ instance.emitted = {};
7557
+ } else if (instance.emitted[handlerName]) {
7558
+ return;
7559
+ }
7560
+ instance.emitted[handlerName] = true;
7561
+ callWithAsyncErrorHandling(
7562
+ onceHandler,
7563
+ instance,
7564
+ 6,
7565
+ args
7566
+ );
7567
+ }
7568
+ {
7569
+ compatModelEmit(instance, event, args);
7570
+ return emit$1(instance, event, args);
7571
+ }
7572
+ }
7573
+ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
7574
+ const cache = appContext.emitsCache;
7575
+ const cached = cache.get(comp);
7576
+ if (cached !== void 0) {
7577
+ return cached;
7578
+ }
7579
+ const raw = comp.emits;
7580
+ let normalized = {};
7581
+ let hasExtends = false;
7582
+ if (!isFunction(comp)) {
7583
+ const extendEmits = (raw2) => {
7584
+ const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
7585
+ if (normalizedFromExtend) {
7586
+ hasExtends = true;
7587
+ extend(normalized, normalizedFromExtend);
7687
7588
  }
7688
- pendingCacheKey = key;
7689
- if (cachedVNode) {
7690
- vnode.el = cachedVNode.el;
7691
- vnode.component = cachedVNode.component;
7692
- if (vnode.transition) {
7693
- setTransitionHooks(vnode, vnode.transition);
7589
+ };
7590
+ if (!asMixin && appContext.mixins.length) {
7591
+ appContext.mixins.forEach(extendEmits);
7592
+ }
7593
+ if (comp.extends) {
7594
+ extendEmits(comp.extends);
7595
+ }
7596
+ if (comp.mixins) {
7597
+ comp.mixins.forEach(extendEmits);
7598
+ }
7599
+ }
7600
+ if (!raw && !hasExtends) {
7601
+ if (isObject(comp)) {
7602
+ cache.set(comp, null);
7603
+ }
7604
+ return null;
7605
+ }
7606
+ if (isArray(raw)) {
7607
+ raw.forEach((key) => normalized[key] = null);
7608
+ } else {
7609
+ extend(normalized, raw);
7610
+ }
7611
+ if (isObject(comp)) {
7612
+ cache.set(comp, normalized);
7613
+ }
7614
+ return normalized;
7615
+ }
7616
+ function isEmitListener(options, key) {
7617
+ if (!options || !isOn(key)) {
7618
+ return false;
7619
+ }
7620
+ if (key.startsWith(compatModelEventPrefix)) {
7621
+ return true;
7622
+ }
7623
+ key = key.slice(2).replace(/Once$/, "");
7624
+ return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
7625
+ }
7626
+
7627
+ function markAttrsAccessed() {
7628
+ }
7629
+ function renderComponentRoot(instance) {
7630
+ const {
7631
+ type: Component,
7632
+ vnode,
7633
+ proxy,
7634
+ withProxy,
7635
+ propsOptions: [propsOptions],
7636
+ slots,
7637
+ attrs,
7638
+ emit,
7639
+ render,
7640
+ renderCache,
7641
+ props,
7642
+ data,
7643
+ setupState,
7644
+ ctx,
7645
+ inheritAttrs
7646
+ } = instance;
7647
+ const prev = setCurrentRenderingInstance(instance);
7648
+ let result;
7649
+ let fallthroughAttrs;
7650
+ try {
7651
+ if (vnode.shapeFlag & 4) {
7652
+ const proxyToUse = withProxy || proxy;
7653
+ const thisProxy = false ? new Proxy(proxyToUse, {
7654
+ get(target, key, receiver) {
7655
+ warn(
7656
+ `Property '${String(
7657
+ key
7658
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
7659
+ );
7660
+ return Reflect.get(target, key, receiver);
7694
7661
  }
7695
- vnode.shapeFlag |= 512;
7696
- keys.delete(key);
7697
- keys.add(key);
7698
- } else {
7699
- keys.add(key);
7700
- if (max && keys.size > parseInt(max, 10)) {
7701
- pruneCacheEntry(keys.values().next().value);
7662
+ }) : proxyToUse;
7663
+ result = normalizeVNode(
7664
+ render.call(
7665
+ thisProxy,
7666
+ proxyToUse,
7667
+ renderCache,
7668
+ false ? shallowReadonly(props) : props,
7669
+ setupState,
7670
+ data,
7671
+ ctx
7672
+ )
7673
+ );
7674
+ fallthroughAttrs = attrs;
7675
+ } else {
7676
+ const render2 = Component;
7677
+ if (false) ;
7678
+ result = normalizeVNode(
7679
+ render2.length > 1 ? render2(
7680
+ false ? shallowReadonly(props) : props,
7681
+ false ? {
7682
+ get attrs() {
7683
+ markAttrsAccessed();
7684
+ return shallowReadonly(attrs);
7685
+ },
7686
+ slots,
7687
+ emit
7688
+ } : { attrs, slots, emit }
7689
+ ) : render2(
7690
+ false ? shallowReadonly(props) : props,
7691
+ null
7692
+ )
7693
+ );
7694
+ fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
7695
+ }
7696
+ } catch (err) {
7697
+ blockStack.length = 0;
7698
+ handleError(err, instance, 1);
7699
+ result = createVNode(Comment);
7700
+ }
7701
+ let root = result;
7702
+ if (fallthroughAttrs && inheritAttrs !== false) {
7703
+ const keys = Object.keys(fallthroughAttrs);
7704
+ const { shapeFlag } = root;
7705
+ if (keys.length) {
7706
+ if (shapeFlag & (1 | 6)) {
7707
+ if (propsOptions && keys.some(isModelListener)) {
7708
+ fallthroughAttrs = filterModelListeners(
7709
+ fallthroughAttrs,
7710
+ propsOptions
7711
+ );
7702
7712
  }
7713
+ root = cloneVNode(root, fallthroughAttrs, false, true);
7703
7714
  }
7704
- vnode.shapeFlag |= 256;
7705
- current = vnode;
7706
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
7707
- };
7715
+ }
7708
7716
  }
7709
- };
7710
- {
7711
- KeepAliveImpl.__isBuildIn = true;
7712
- }
7713
- const KeepAlive = KeepAliveImpl;
7714
- function matches(pattern, name) {
7715
- if (isArray(pattern)) {
7716
- return pattern.some((p) => matches(p, name));
7717
- } else if (isString(pattern)) {
7718
- return pattern.split(",").includes(name);
7719
- } else if (isRegExp(pattern)) {
7720
- return pattern.test(name);
7717
+ if (isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance) && vnode.shapeFlag & 4 && root.shapeFlag & (1 | 6)) {
7718
+ const { class: cls, style } = vnode.props || {};
7719
+ if (cls || style) {
7720
+ root = cloneVNode(
7721
+ root,
7722
+ {
7723
+ class: cls,
7724
+ style
7725
+ },
7726
+ false,
7727
+ true
7728
+ );
7729
+ }
7721
7730
  }
7722
- return false;
7723
- }
7724
- function onActivated(hook, target) {
7725
- registerKeepAliveHook(hook, "a", target);
7731
+ if (vnode.dirs) {
7732
+ root = cloneVNode(root, null, false, true);
7733
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7734
+ }
7735
+ if (vnode.transition) {
7736
+ root.transition = vnode.transition;
7737
+ }
7738
+ {
7739
+ result = root;
7740
+ }
7741
+ setCurrentRenderingInstance(prev);
7742
+ return result;
7726
7743
  }
7727
- function onDeactivated(hook, target) {
7728
- registerKeepAliveHook(hook, "da", target);
7744
+ function filterSingleRoot(children, recurse = true) {
7745
+ let singleRoot;
7746
+ for (let i = 0; i < children.length; i++) {
7747
+ const child = children[i];
7748
+ if (isVNode(child)) {
7749
+ if (child.type !== Comment || child.children === "v-if") {
7750
+ if (singleRoot) {
7751
+ return;
7752
+ } else {
7753
+ singleRoot = child;
7754
+ }
7755
+ }
7756
+ } else {
7757
+ return;
7758
+ }
7759
+ }
7760
+ return singleRoot;
7729
7761
  }
7730
- function registerKeepAliveHook(hook, type, target = currentInstance) {
7731
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
7732
- let current = target;
7733
- while (current) {
7734
- if (current.isDeactivated) {
7735
- return;
7762
+ const getFunctionalFallthrough = (attrs) => {
7763
+ let res;
7764
+ for (const key in attrs) {
7765
+ if (key === "class" || key === "style" || isOn(key)) {
7766
+ (res || (res = {}))[key] = attrs[key];
7767
+ }
7768
+ }
7769
+ return res;
7770
+ };
7771
+ const filterModelListeners = (attrs, props) => {
7772
+ const res = {};
7773
+ for (const key in attrs) {
7774
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
7775
+ res[key] = attrs[key];
7776
+ }
7777
+ }
7778
+ return res;
7779
+ };
7780
+ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
7781
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
7782
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
7783
+ const emits = component.emitsOptions;
7784
+ if (nextVNode.dirs || nextVNode.transition) {
7785
+ return true;
7786
+ }
7787
+ if (optimized && patchFlag >= 0) {
7788
+ if (patchFlag & 1024) {
7789
+ return true;
7790
+ }
7791
+ if (patchFlag & 16) {
7792
+ if (!prevProps) {
7793
+ return !!nextProps;
7794
+ }
7795
+ return hasPropsChanged(prevProps, nextProps, emits);
7796
+ } else if (patchFlag & 8) {
7797
+ const dynamicProps = nextVNode.dynamicProps;
7798
+ for (let i = 0; i < dynamicProps.length; i++) {
7799
+ const key = dynamicProps[i];
7800
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
7801
+ return true;
7802
+ }
7736
7803
  }
7737
- current = current.parent;
7738
7804
  }
7739
- return hook();
7740
- });
7741
- injectHook(type, wrappedHook, target);
7742
- if (target) {
7743
- let current = target.parent;
7744
- while (current && current.parent) {
7745
- if (isKeepAlive(current.parent.vnode)) {
7746
- injectToKeepAliveRoot(wrappedHook, type, target, current);
7805
+ } else {
7806
+ if (prevChildren || nextChildren) {
7807
+ if (!nextChildren || !nextChildren.$stable) {
7808
+ return true;
7747
7809
  }
7748
- current = current.parent;
7749
7810
  }
7811
+ if (prevProps === nextProps) {
7812
+ return false;
7813
+ }
7814
+ if (!prevProps) {
7815
+ return !!nextProps;
7816
+ }
7817
+ if (!nextProps) {
7818
+ return true;
7819
+ }
7820
+ return hasPropsChanged(prevProps, nextProps, emits);
7750
7821
  }
7822
+ return false;
7751
7823
  }
7752
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
7753
- const injected = injectHook(
7754
- type,
7755
- hook,
7756
- keepAliveRoot,
7757
- true
7758
- /* prepend */
7759
- );
7760
- onUnmounted(() => {
7761
- remove(keepAliveRoot[type], injected);
7762
- }, target);
7763
- }
7764
- function resetShapeFlag(vnode) {
7765
- vnode.shapeFlag &= ~256;
7766
- vnode.shapeFlag &= ~512;
7824
+ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
7825
+ const nextKeys = Object.keys(nextProps);
7826
+ if (nextKeys.length !== Object.keys(prevProps).length) {
7827
+ return true;
7828
+ }
7829
+ for (let i = 0; i < nextKeys.length; i++) {
7830
+ const key = nextKeys[i];
7831
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
7832
+ return true;
7833
+ }
7834
+ }
7835
+ return false;
7767
7836
  }
7768
- function getInnerChild(vnode) {
7769
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
7837
+ function updateHOCHostEl({ vnode, parent }, el) {
7838
+ while (parent) {
7839
+ const root = parent.subTree;
7840
+ if (root.suspense && root.suspense.activeBranch === vnode) {
7841
+ root.el = vnode.el;
7842
+ }
7843
+ if (root === vnode) {
7844
+ (vnode = parent.vnode).el = el;
7845
+ parent = parent.parent;
7846
+ } else {
7847
+ break;
7848
+ }
7849
+ }
7770
7850
  }
7771
7851
 
7772
- const leaveCbKey = Symbol("_leaveCb");
7773
- const enterCbKey$1 = Symbol("_enterCb");
7774
- function useTransitionState() {
7775
- const state = {
7776
- isMounted: false,
7777
- isLeaving: false,
7778
- isUnmounting: false,
7779
- leavingVNodes: /* @__PURE__ */ new Map()
7780
- };
7781
- onMounted(() => {
7782
- state.isMounted = true;
7783
- });
7784
- onBeforeUnmount(() => {
7785
- state.isUnmounting = true;
7786
- });
7787
- return state;
7788
- }
7789
- const TransitionHookValidator = [Function, Array];
7790
- const BaseTransitionPropsValidators = {
7791
- mode: String,
7792
- appear: Boolean,
7793
- persisted: Boolean,
7794
- // enter
7795
- onBeforeEnter: TransitionHookValidator,
7796
- onEnter: TransitionHookValidator,
7797
- onAfterEnter: TransitionHookValidator,
7798
- onEnterCancelled: TransitionHookValidator,
7799
- // leave
7800
- onBeforeLeave: TransitionHookValidator,
7801
- onLeave: TransitionHookValidator,
7802
- onAfterLeave: TransitionHookValidator,
7803
- onLeaveCancelled: TransitionHookValidator,
7804
- // appear
7805
- onBeforeAppear: TransitionHookValidator,
7806
- onAppear: TransitionHookValidator,
7807
- onAfterAppear: TransitionHookValidator,
7808
- onAppearCancelled: TransitionHookValidator
7809
- };
7810
- const recursiveGetSubtree = (instance) => {
7811
- const subTree = instance.subTree;
7812
- return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
7813
- };
7814
- const BaseTransitionImpl = {
7815
- name: `BaseTransition`,
7816
- props: BaseTransitionPropsValidators,
7817
- setup(props, { slots }) {
7818
- const instance = getCurrentInstance();
7819
- const state = useTransitionState();
7820
- return () => {
7821
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
7822
- if (!children || !children.length) {
7852
+ const isSuspense = (type) => type.__isSuspense;
7853
+ let suspenseId = 0;
7854
+ const SuspenseImpl = {
7855
+ name: "Suspense",
7856
+ // In order to make Suspense tree-shakable, we need to avoid importing it
7857
+ // directly in the renderer. The renderer checks for the __isSuspense flag
7858
+ // on a vnode's type and calls the `process` method, passing in renderer
7859
+ // internals.
7860
+ __isSuspense: true,
7861
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
7862
+ if (n1 == null) {
7863
+ mountSuspense(
7864
+ n2,
7865
+ container,
7866
+ anchor,
7867
+ parentComponent,
7868
+ parentSuspense,
7869
+ namespace,
7870
+ slotScopeIds,
7871
+ optimized,
7872
+ rendererInternals
7873
+ );
7874
+ } else {
7875
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
7876
+ n2.suspense = n1.suspense;
7877
+ n2.suspense.vnode = n2;
7878
+ n2.el = n1.el;
7823
7879
  return;
7824
7880
  }
7825
- let child = children[0];
7826
- if (children.length > 1) {
7827
- for (const c of children) {
7828
- if (c.type !== Comment) {
7829
- child = c;
7830
- break;
7831
- }
7832
- }
7833
- }
7834
- const rawProps = toRaw(props);
7835
- const { mode } = rawProps;
7836
- if (state.isLeaving) {
7837
- return emptyPlaceholder(child);
7838
- }
7839
- const innerChild = getKeepAliveChild(child);
7840
- if (!innerChild) {
7841
- return emptyPlaceholder(child);
7842
- }
7843
- let enterHooks = resolveTransitionHooks(
7844
- innerChild,
7845
- rawProps,
7846
- state,
7847
- instance,
7848
- // #11061, ensure enterHooks is fresh after clone
7849
- (hooks) => enterHooks = hooks
7881
+ patchSuspense(
7882
+ n1,
7883
+ n2,
7884
+ container,
7885
+ anchor,
7886
+ parentComponent,
7887
+ namespace,
7888
+ slotScopeIds,
7889
+ optimized,
7890
+ rendererInternals
7850
7891
  );
7851
- setTransitionHooks(innerChild, enterHooks);
7852
- const oldChild = instance.subTree;
7853
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
7854
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
7855
- const leavingHooks = resolveTransitionHooks(
7856
- oldInnerChild,
7857
- rawProps,
7858
- state,
7859
- instance
7860
- );
7861
- setTransitionHooks(oldInnerChild, leavingHooks);
7862
- if (mode === "out-in" && innerChild.type !== Comment) {
7863
- state.isLeaving = true;
7864
- leavingHooks.afterLeave = () => {
7865
- state.isLeaving = false;
7866
- if (instance.update.active !== false) {
7867
- instance.effect.dirty = true;
7868
- instance.update();
7869
- }
7870
- };
7871
- return emptyPlaceholder(child);
7872
- } else if (mode === "in-out" && innerChild.type !== Comment) {
7873
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
7874
- const leavingVNodesCache = getLeavingNodesForType(
7875
- state,
7876
- oldInnerChild
7877
- );
7878
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
7879
- el[leaveCbKey] = () => {
7880
- earlyRemove();
7881
- el[leaveCbKey] = void 0;
7882
- delete enterHooks.delayedLeave;
7883
- };
7884
- enterHooks.delayedLeave = delayedLeave;
7885
- };
7886
- }
7887
- }
7888
- return child;
7889
- };
7890
- }
7892
+ }
7893
+ },
7894
+ hydrate: hydrateSuspense,
7895
+ normalize: normalizeSuspenseChildren
7891
7896
  };
7892
- {
7893
- BaseTransitionImpl.__isBuiltIn = true;
7894
- }
7895
- const BaseTransition = BaseTransitionImpl;
7896
- function getLeavingNodesForType(state, vnode) {
7897
- const { leavingVNodes } = state;
7898
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
7899
- if (!leavingVNodesCache) {
7900
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
7901
- leavingVNodes.set(vnode.type, leavingVNodesCache);
7897
+ const Suspense = SuspenseImpl ;
7898
+ function triggerEvent(vnode, name) {
7899
+ const eventListener = vnode.props && vnode.props[name];
7900
+ if (isFunction(eventListener)) {
7901
+ eventListener();
7902
7902
  }
7903
- return leavingVNodesCache;
7904
7903
  }
7905
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
7904
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
7906
7905
  const {
7907
- appear,
7908
- mode,
7909
- persisted = false,
7910
- onBeforeEnter,
7911
- onEnter,
7912
- onAfterEnter,
7913
- onEnterCancelled,
7914
- onBeforeLeave,
7915
- onLeave,
7916
- onAfterLeave,
7917
- onLeaveCancelled,
7918
- onBeforeAppear,
7919
- onAppear,
7920
- onAfterAppear,
7921
- onAppearCancelled
7922
- } = props;
7923
- const key = String(vnode.key);
7924
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
7925
- const callHook = (hook, args) => {
7926
- hook && callWithAsyncErrorHandling(
7927
- hook,
7928
- instance,
7929
- 9,
7930
- args
7906
+ p: patch,
7907
+ o: { createElement }
7908
+ } = rendererInternals;
7909
+ const hiddenContainer = createElement("div");
7910
+ const suspense = vnode.suspense = createSuspenseBoundary(
7911
+ vnode,
7912
+ parentSuspense,
7913
+ parentComponent,
7914
+ container,
7915
+ hiddenContainer,
7916
+ anchor,
7917
+ namespace,
7918
+ slotScopeIds,
7919
+ optimized,
7920
+ rendererInternals
7921
+ );
7922
+ patch(
7923
+ null,
7924
+ suspense.pendingBranch = vnode.ssContent,
7925
+ hiddenContainer,
7926
+ null,
7927
+ parentComponent,
7928
+ suspense,
7929
+ namespace,
7930
+ slotScopeIds
7931
+ );
7932
+ if (suspense.deps > 0) {
7933
+ triggerEvent(vnode, "onPending");
7934
+ triggerEvent(vnode, "onFallback");
7935
+ patch(
7936
+ null,
7937
+ vnode.ssFallback,
7938
+ container,
7939
+ anchor,
7940
+ parentComponent,
7941
+ null,
7942
+ // fallback tree will not have suspense context
7943
+ namespace,
7944
+ slotScopeIds
7931
7945
  );
7932
- };
7933
- const callAsyncHook = (hook, args) => {
7934
- const done = args[1];
7935
- callHook(hook, args);
7936
- if (isArray(hook)) {
7937
- if (hook.every((hook2) => hook2.length <= 1)) done();
7938
- } else if (hook.length <= 1) {
7939
- done();
7940
- }
7941
- };
7942
- const hooks = {
7943
- mode,
7944
- persisted,
7945
- beforeEnter(el) {
7946
- let hook = onBeforeEnter;
7947
- if (!state.isMounted) {
7948
- if (appear) {
7949
- hook = onBeforeAppear || onBeforeEnter;
7950
- } else {
7951
- return;
7952
- }
7953
- }
7954
- if (el[leaveCbKey]) {
7955
- el[leaveCbKey](
7956
- true
7957
- /* cancelled */
7958
- );
7959
- }
7960
- const leavingVNode = leavingVNodesCache[key];
7961
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
7962
- leavingVNode.el[leaveCbKey]();
7963
- }
7964
- callHook(hook, [el]);
7965
- },
7966
- enter(el) {
7967
- let hook = onEnter;
7968
- let afterHook = onAfterEnter;
7969
- let cancelHook = onEnterCancelled;
7970
- if (!state.isMounted) {
7971
- if (appear) {
7972
- hook = onAppear || onEnter;
7973
- afterHook = onAfterAppear || onAfterEnter;
7974
- cancelHook = onAppearCancelled || onEnterCancelled;
7975
- } else {
7976
- return;
7977
- }
7978
- }
7979
- let called = false;
7980
- const done = el[enterCbKey$1] = (cancelled) => {
7981
- if (called) return;
7982
- called = true;
7983
- if (cancelled) {
7984
- callHook(cancelHook, [el]);
7985
- } else {
7986
- callHook(afterHook, [el]);
7987
- }
7988
- if (hooks.delayedLeave) {
7989
- hooks.delayedLeave();
7946
+ setActiveBranch(suspense, vnode.ssFallback);
7947
+ } else {
7948
+ suspense.resolve(false, true);
7949
+ }
7950
+ }
7951
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
7952
+ const suspense = n2.suspense = n1.suspense;
7953
+ suspense.vnode = n2;
7954
+ n2.el = n1.el;
7955
+ const newBranch = n2.ssContent;
7956
+ const newFallback = n2.ssFallback;
7957
+ const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
7958
+ if (pendingBranch) {
7959
+ suspense.pendingBranch = newBranch;
7960
+ if (isSameVNodeType(newBranch, pendingBranch)) {
7961
+ patch(
7962
+ pendingBranch,
7963
+ newBranch,
7964
+ suspense.hiddenContainer,
7965
+ null,
7966
+ parentComponent,
7967
+ suspense,
7968
+ namespace,
7969
+ slotScopeIds,
7970
+ optimized
7971
+ );
7972
+ if (suspense.deps <= 0) {
7973
+ suspense.resolve();
7974
+ } else if (isInFallback) {
7975
+ if (!isHydrating) {
7976
+ patch(
7977
+ activeBranch,
7978
+ newFallback,
7979
+ container,
7980
+ anchor,
7981
+ parentComponent,
7982
+ null,
7983
+ // fallback tree will not have suspense context
7984
+ namespace,
7985
+ slotScopeIds,
7986
+ optimized
7987
+ );
7988
+ setActiveBranch(suspense, newFallback);
7990
7989
  }
7991
- el[enterCbKey$1] = void 0;
7992
- };
7993
- if (hook) {
7994
- callAsyncHook(hook, [el, done]);
7990
+ }
7991
+ } else {
7992
+ suspense.pendingId = suspenseId++;
7993
+ if (isHydrating) {
7994
+ suspense.isHydrating = false;
7995
+ suspense.activeBranch = pendingBranch;
7995
7996
  } else {
7996
- done();
7997
+ unmount(pendingBranch, parentComponent, suspense);
7997
7998
  }
7998
- },
7999
- leave(el, remove) {
8000
- const key2 = String(vnode.key);
8001
- if (el[enterCbKey$1]) {
8002
- el[enterCbKey$1](
8003
- true
8004
- /* cancelled */
7999
+ suspense.deps = 0;
8000
+ suspense.effects.length = 0;
8001
+ suspense.hiddenContainer = createElement("div");
8002
+ if (isInFallback) {
8003
+ patch(
8004
+ null,
8005
+ newBranch,
8006
+ suspense.hiddenContainer,
8007
+ null,
8008
+ parentComponent,
8009
+ suspense,
8010
+ namespace,
8011
+ slotScopeIds,
8012
+ optimized
8005
8013
  );
8006
- }
8007
- if (state.isUnmounting) {
8008
- return remove();
8009
- }
8010
- callHook(onBeforeLeave, [el]);
8011
- let called = false;
8012
- const done = el[leaveCbKey] = (cancelled) => {
8013
- if (called) return;
8014
- called = true;
8015
- remove();
8016
- if (cancelled) {
8017
- callHook(onLeaveCancelled, [el]);
8014
+ if (suspense.deps <= 0) {
8015
+ suspense.resolve();
8018
8016
  } else {
8019
- callHook(onAfterLeave, [el]);
8020
- }
8021
- el[leaveCbKey] = void 0;
8022
- if (leavingVNodesCache[key2] === vnode) {
8023
- delete leavingVNodesCache[key2];
8017
+ patch(
8018
+ activeBranch,
8019
+ newFallback,
8020
+ container,
8021
+ anchor,
8022
+ parentComponent,
8023
+ null,
8024
+ // fallback tree will not have suspense context
8025
+ namespace,
8026
+ slotScopeIds,
8027
+ optimized
8028
+ );
8029
+ setActiveBranch(suspense, newFallback);
8024
8030
  }
8025
- };
8026
- leavingVNodesCache[key2] = vnode;
8027
- if (onLeave) {
8028
- callAsyncHook(onLeave, [el, done]);
8031
+ } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8032
+ patch(
8033
+ activeBranch,
8034
+ newBranch,
8035
+ container,
8036
+ anchor,
8037
+ parentComponent,
8038
+ suspense,
8039
+ namespace,
8040
+ slotScopeIds,
8041
+ optimized
8042
+ );
8043
+ suspense.resolve(true);
8029
8044
  } else {
8030
- done();
8045
+ patch(
8046
+ null,
8047
+ newBranch,
8048
+ suspense.hiddenContainer,
8049
+ null,
8050
+ parentComponent,
8051
+ suspense,
8052
+ namespace,
8053
+ slotScopeIds,
8054
+ optimized
8055
+ );
8056
+ if (suspense.deps <= 0) {
8057
+ suspense.resolve();
8058
+ }
8031
8059
  }
8032
- },
8033
- clone(vnode2) {
8034
- const hooks2 = resolveTransitionHooks(
8035
- vnode2,
8036
- props,
8037
- state,
8038
- instance,
8039
- postClone
8040
- );
8041
- if (postClone) postClone(hooks2);
8042
- return hooks2;
8043
- }
8044
- };
8045
- return hooks;
8046
- }
8047
- function emptyPlaceholder(vnode) {
8048
- if (isKeepAlive(vnode)) {
8049
- vnode = cloneVNode(vnode);
8050
- vnode.children = null;
8051
- return vnode;
8052
- }
8053
- }
8054
- function getKeepAliveChild(vnode) {
8055
- if (!isKeepAlive(vnode)) {
8056
- return vnode;
8057
- }
8058
- const { shapeFlag, children } = vnode;
8059
- if (children) {
8060
- if (shapeFlag & 16) {
8061
- return children[0];
8062
- }
8063
- if (shapeFlag & 32 && isFunction(children.default)) {
8064
- return children.default();
8065
8060
  }
8066
- }
8067
- }
8068
- function setTransitionHooks(vnode, hooks) {
8069
- if (vnode.shapeFlag & 6 && vnode.component) {
8070
- setTransitionHooks(vnode.component.subTree, hooks);
8071
- } else if (vnode.shapeFlag & 128) {
8072
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
8073
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
8074
8061
  } else {
8075
- vnode.transition = hooks;
8076
- }
8077
- }
8078
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
8079
- let ret = [];
8080
- let keyedFragmentCount = 0;
8081
- for (let i = 0; i < children.length; i++) {
8082
- let child = children[i];
8083
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
8084
- if (child.type === Fragment) {
8085
- if (child.patchFlag & 128) keyedFragmentCount++;
8086
- ret = ret.concat(
8087
- getTransitionRawChildren(child.children, keepComment, key)
8062
+ if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8063
+ patch(
8064
+ activeBranch,
8065
+ newBranch,
8066
+ container,
8067
+ anchor,
8068
+ parentComponent,
8069
+ suspense,
8070
+ namespace,
8071
+ slotScopeIds,
8072
+ optimized
8088
8073
  );
8089
- } else if (keepComment || child.type !== Comment) {
8090
- ret.push(key != null ? cloneVNode(child, { key }) : child);
8091
- }
8092
- }
8093
- if (keyedFragmentCount > 1) {
8094
- for (let i = 0; i < ret.length; i++) {
8095
- ret[i].patchFlag = -2;
8096
- }
8097
- }
8098
- return ret;
8099
- }
8100
-
8101
- const isTeleport = (type) => type.__isTeleport;
8102
- const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
8103
- const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
8104
- const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
8105
- const resolveTarget = (props, select) => {
8106
- const targetSelector = props && props.to;
8107
- if (isString(targetSelector)) {
8108
- if (!select) {
8109
- return null;
8074
+ setActiveBranch(suspense, newBranch);
8110
8075
  } else {
8111
- const target = select(targetSelector);
8112
- return target;
8076
+ triggerEvent(n2, "onPending");
8077
+ suspense.pendingBranch = newBranch;
8078
+ if (newBranch.shapeFlag & 512) {
8079
+ suspense.pendingId = newBranch.component.suspenseId;
8080
+ } else {
8081
+ suspense.pendingId = suspenseId++;
8082
+ }
8083
+ patch(
8084
+ null,
8085
+ newBranch,
8086
+ suspense.hiddenContainer,
8087
+ null,
8088
+ parentComponent,
8089
+ suspense,
8090
+ namespace,
8091
+ slotScopeIds,
8092
+ optimized
8093
+ );
8094
+ if (suspense.deps <= 0) {
8095
+ suspense.resolve();
8096
+ } else {
8097
+ const { timeout, pendingId } = suspense;
8098
+ if (timeout > 0) {
8099
+ setTimeout(() => {
8100
+ if (suspense.pendingId === pendingId) {
8101
+ suspense.fallback(newFallback);
8102
+ }
8103
+ }, timeout);
8104
+ } else if (timeout === 0) {
8105
+ suspense.fallback(newFallback);
8106
+ }
8107
+ }
8113
8108
  }
8114
- } else {
8115
- return targetSelector;
8116
8109
  }
8117
- };
8118
- const TeleportImpl = {
8119
- name: "Teleport",
8120
- __isTeleport: true,
8121
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
8122
- const {
8123
- mc: mountChildren,
8124
- pc: patchChildren,
8125
- pbc: patchBlockChildren,
8126
- o: { insert, querySelector, createText, createComment }
8127
- } = internals;
8128
- const disabled = isTeleportDisabled(n2.props);
8129
- let { shapeFlag, children, dynamicChildren } = n2;
8130
- if (n1 == null) {
8131
- const placeholder = n2.el = createText("");
8132
- const mainAnchor = n2.anchor = createText("");
8133
- insert(placeholder, container, anchor);
8134
- insert(mainAnchor, container, anchor);
8135
- const target = n2.target = resolveTarget(n2.props, querySelector);
8136
- const targetAnchor = n2.targetAnchor = createText("");
8137
- if (target) {
8138
- insert(targetAnchor, target);
8139
- if (namespace === "svg" || isTargetSVG(target)) {
8140
- namespace = "svg";
8141
- } else if (namespace === "mathml" || isTargetMathML(target)) {
8142
- namespace = "mathml";
8110
+ }
8111
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
8112
+ const {
8113
+ p: patch,
8114
+ m: move,
8115
+ um: unmount,
8116
+ n: next,
8117
+ o: { parentNode, remove }
8118
+ } = rendererInternals;
8119
+ let parentSuspenseId;
8120
+ const isSuspensible = isVNodeSuspensible(vnode);
8121
+ if (isSuspensible) {
8122
+ if (parentSuspense && parentSuspense.pendingBranch) {
8123
+ parentSuspenseId = parentSuspense.pendingId;
8124
+ parentSuspense.deps++;
8125
+ }
8126
+ }
8127
+ const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
8128
+ const initialAnchor = anchor;
8129
+ const suspense = {
8130
+ vnode,
8131
+ parent: parentSuspense,
8132
+ parentComponent,
8133
+ namespace,
8134
+ container,
8135
+ hiddenContainer,
8136
+ deps: 0,
8137
+ pendingId: suspenseId++,
8138
+ timeout: typeof timeout === "number" ? timeout : -1,
8139
+ activeBranch: null,
8140
+ pendingBranch: null,
8141
+ isInFallback: !isHydrating,
8142
+ isHydrating,
8143
+ isUnmounted: false,
8144
+ effects: [],
8145
+ resolve(resume = false, sync = false) {
8146
+ const {
8147
+ vnode: vnode2,
8148
+ activeBranch,
8149
+ pendingBranch,
8150
+ pendingId,
8151
+ effects,
8152
+ parentComponent: parentComponent2,
8153
+ container: container2
8154
+ } = suspense;
8155
+ let delayEnter = false;
8156
+ if (suspense.isHydrating) {
8157
+ suspense.isHydrating = false;
8158
+ } else if (!resume) {
8159
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8160
+ if (delayEnter) {
8161
+ activeBranch.transition.afterLeave = () => {
8162
+ if (pendingId === suspense.pendingId) {
8163
+ move(
8164
+ pendingBranch,
8165
+ container2,
8166
+ anchor === initialAnchor ? next(activeBranch) : anchor,
8167
+ 0
8168
+ );
8169
+ queuePostFlushCb(effects);
8170
+ }
8171
+ };
8172
+ }
8173
+ if (activeBranch) {
8174
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
8175
+ anchor = next(activeBranch);
8176
+ }
8177
+ unmount(activeBranch, parentComponent2, suspense, true);
8178
+ }
8179
+ if (!delayEnter) {
8180
+ move(pendingBranch, container2, anchor, 0);
8143
8181
  }
8144
8182
  }
8145
- const mount = (container2, anchor2) => {
8146
- if (shapeFlag & 16) {
8147
- mountChildren(
8148
- children,
8149
- container2,
8150
- anchor2,
8151
- parentComponent,
8152
- parentSuspense,
8153
- namespace,
8154
- slotScopeIds,
8155
- optimized
8156
- );
8183
+ setActiveBranch(suspense, pendingBranch);
8184
+ suspense.pendingBranch = null;
8185
+ suspense.isInFallback = false;
8186
+ let parent = suspense.parent;
8187
+ let hasUnresolvedAncestor = false;
8188
+ while (parent) {
8189
+ if (parent.pendingBranch) {
8190
+ parent.effects.push(...effects);
8191
+ hasUnresolvedAncestor = true;
8192
+ break;
8157
8193
  }
8158
- };
8159
- if (disabled) {
8160
- mount(container, mainAnchor);
8161
- } else if (target) {
8162
- mount(target, targetAnchor);
8194
+ parent = parent.parent;
8163
8195
  }
8164
- } else {
8165
- n2.el = n1.el;
8166
- const mainAnchor = n2.anchor = n1.anchor;
8167
- const target = n2.target = n1.target;
8168
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
8169
- const wasDisabled = isTeleportDisabled(n1.props);
8170
- const currentContainer = wasDisabled ? container : target;
8171
- const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
8172
- if (namespace === "svg" || isTargetSVG(target)) {
8173
- namespace = "svg";
8174
- } else if (namespace === "mathml" || isTargetMathML(target)) {
8175
- namespace = "mathml";
8196
+ if (!hasUnresolvedAncestor && !delayEnter) {
8197
+ queuePostFlushCb(effects);
8176
8198
  }
8177
- if (dynamicChildren) {
8178
- patchBlockChildren(
8179
- n1.dynamicChildren,
8180
- dynamicChildren,
8181
- currentContainer,
8182
- parentComponent,
8183
- parentSuspense,
8184
- namespace,
8185
- slotScopeIds
8186
- );
8187
- traverseStaticChildren(n1, n2, true);
8188
- } else if (!optimized) {
8189
- patchChildren(
8190
- n1,
8191
- n2,
8192
- currentContainer,
8193
- currentAnchor,
8194
- parentComponent,
8195
- parentSuspense,
8196
- namespace,
8199
+ suspense.effects = [];
8200
+ if (isSuspensible) {
8201
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
8202
+ parentSuspense.deps--;
8203
+ if (parentSuspense.deps === 0 && !sync) {
8204
+ parentSuspense.resolve();
8205
+ }
8206
+ }
8207
+ }
8208
+ triggerEvent(vnode2, "onResolve");
8209
+ },
8210
+ fallback(fallbackVNode) {
8211
+ if (!suspense.pendingBranch) {
8212
+ return;
8213
+ }
8214
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
8215
+ triggerEvent(vnode2, "onFallback");
8216
+ const anchor2 = next(activeBranch);
8217
+ const mountFallback = () => {
8218
+ if (!suspense.isInFallback) {
8219
+ return;
8220
+ }
8221
+ patch(
8222
+ null,
8223
+ fallbackVNode,
8224
+ container2,
8225
+ anchor2,
8226
+ parentComponent2,
8227
+ null,
8228
+ // fallback tree will not have suspense context
8229
+ namespace2,
8197
8230
  slotScopeIds,
8198
- false
8231
+ optimized
8199
8232
  );
8233
+ setActiveBranch(suspense, fallbackVNode);
8234
+ };
8235
+ const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
8236
+ if (delayEnter) {
8237
+ activeBranch.transition.afterLeave = mountFallback;
8200
8238
  }
8201
- if (disabled) {
8202
- if (!wasDisabled) {
8203
- moveTeleport(
8204
- n2,
8205
- container,
8206
- mainAnchor,
8207
- internals,
8208
- 1
8209
- );
8210
- } else {
8211
- if (n2.props && n1.props && n2.props.to !== n1.props.to) {
8212
- n2.props.to = n1.props.to;
8213
- }
8239
+ suspense.isInFallback = true;
8240
+ unmount(
8241
+ activeBranch,
8242
+ parentComponent2,
8243
+ null,
8244
+ // no suspense so unmount hooks fire now
8245
+ true
8246
+ // shouldRemove
8247
+ );
8248
+ if (!delayEnter) {
8249
+ mountFallback();
8250
+ }
8251
+ },
8252
+ move(container2, anchor2, type) {
8253
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
8254
+ suspense.container = container2;
8255
+ },
8256
+ next() {
8257
+ return suspense.activeBranch && next(suspense.activeBranch);
8258
+ },
8259
+ registerDep(instance, setupRenderEffect, optimized2) {
8260
+ const isInPendingSuspense = !!suspense.pendingBranch;
8261
+ if (isInPendingSuspense) {
8262
+ suspense.deps++;
8263
+ }
8264
+ const hydratedEl = instance.vnode.el;
8265
+ instance.asyncDep.catch((err) => {
8266
+ handleError(err, instance, 0);
8267
+ }).then((asyncSetupResult) => {
8268
+ if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
8269
+ return;
8214
8270
  }
8215
- } else {
8216
- if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
8217
- const nextTarget = n2.target = resolveTarget(
8218
- n2.props,
8219
- querySelector
8220
- );
8221
- if (nextTarget) {
8222
- moveTeleport(
8223
- n2,
8224
- nextTarget,
8225
- null,
8226
- internals,
8227
- 0
8228
- );
8229
- }
8230
- } else if (wasDisabled) {
8231
- moveTeleport(
8232
- n2,
8233
- target,
8234
- targetAnchor,
8235
- internals,
8236
- 1
8237
- );
8271
+ instance.asyncResolved = true;
8272
+ const { vnode: vnode2 } = instance;
8273
+ handleSetupResult(instance, asyncSetupResult, false);
8274
+ if (hydratedEl) {
8275
+ vnode2.el = hydratedEl;
8276
+ }
8277
+ const placeholder = !hydratedEl && instance.subTree.el;
8278
+ setupRenderEffect(
8279
+ instance,
8280
+ vnode2,
8281
+ // component may have been moved before resolve.
8282
+ // if this is not a hydration, instance.subTree will be the comment
8283
+ // placeholder.
8284
+ parentNode(hydratedEl || instance.subTree.el),
8285
+ // anchor will not be used if this is hydration, so only need to
8286
+ // consider the comment placeholder case.
8287
+ hydratedEl ? null : next(instance.subTree),
8288
+ suspense,
8289
+ namespace,
8290
+ optimized2
8291
+ );
8292
+ if (placeholder) {
8293
+ remove(placeholder);
8238
8294
  }
8239
- }
8240
- }
8241
- updateCssVars(n2);
8242
- },
8243
- remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8244
- const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8245
- if (target) {
8246
- hostRemove(targetAnchor);
8247
- }
8248
- doRemove && hostRemove(anchor);
8249
- if (shapeFlag & 16) {
8250
- const shouldRemove = doRemove || !isTeleportDisabled(props);
8251
- for (let i = 0; i < children.length; i++) {
8252
- const child = children[i];
8295
+ updateHOCHostEl(instance, vnode2.el);
8296
+ if (isInPendingSuspense && --suspense.deps === 0) {
8297
+ suspense.resolve();
8298
+ }
8299
+ });
8300
+ },
8301
+ unmount(parentSuspense2, doRemove) {
8302
+ suspense.isUnmounted = true;
8303
+ if (suspense.activeBranch) {
8253
8304
  unmount(
8254
- child,
8305
+ suspense.activeBranch,
8255
8306
  parentComponent,
8256
- parentSuspense,
8257
- shouldRemove,
8258
- !!child.dynamicChildren
8307
+ parentSuspense2,
8308
+ doRemove
8259
8309
  );
8260
8310
  }
8261
- }
8262
- },
8263
- move: moveTeleport,
8264
- hydrate: hydrateTeleport
8265
- };
8266
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
8267
- if (moveType === 0) {
8268
- insert(vnode.targetAnchor, container, parentAnchor);
8269
- }
8270
- const { el, anchor, shapeFlag, children, props } = vnode;
8271
- const isReorder = moveType === 2;
8272
- if (isReorder) {
8273
- insert(el, container, parentAnchor);
8274
- }
8275
- if (!isReorder || isTeleportDisabled(props)) {
8276
- if (shapeFlag & 16) {
8277
- for (let i = 0; i < children.length; i++) {
8278
- move(
8279
- children[i],
8280
- container,
8281
- parentAnchor,
8282
- 2
8311
+ if (suspense.pendingBranch) {
8312
+ unmount(
8313
+ suspense.pendingBranch,
8314
+ parentComponent,
8315
+ parentSuspense2,
8316
+ doRemove
8283
8317
  );
8284
8318
  }
8285
8319
  }
8320
+ };
8321
+ return suspense;
8322
+ }
8323
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
8324
+ const suspense = vnode.suspense = createSuspenseBoundary(
8325
+ vnode,
8326
+ parentSuspense,
8327
+ parentComponent,
8328
+ node.parentNode,
8329
+ // eslint-disable-next-line no-restricted-globals
8330
+ document.createElement("div"),
8331
+ null,
8332
+ namespace,
8333
+ slotScopeIds,
8334
+ optimized,
8335
+ rendererInternals,
8336
+ true
8337
+ );
8338
+ const result = hydrateNode(
8339
+ node,
8340
+ suspense.pendingBranch = vnode.ssContent,
8341
+ parentComponent,
8342
+ suspense,
8343
+ slotScopeIds,
8344
+ optimized
8345
+ );
8346
+ if (suspense.deps === 0) {
8347
+ suspense.resolve(false, true);
8286
8348
  }
8287
- if (isReorder) {
8288
- insert(anchor, container, parentAnchor);
8289
- }
8349
+ return result;
8290
8350
  }
8291
- function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
8292
- o: { nextSibling, parentNode, querySelector }
8293
- }, hydrateChildren) {
8294
- const target = vnode.target = resolveTarget(
8295
- vnode.props,
8296
- querySelector
8351
+ function normalizeSuspenseChildren(vnode) {
8352
+ const { shapeFlag, children } = vnode;
8353
+ const isSlotChildren = shapeFlag & 32;
8354
+ vnode.ssContent = normalizeSuspenseSlot(
8355
+ isSlotChildren ? children.default : children
8297
8356
  );
8298
- if (target) {
8299
- const targetNode = target._lpa || target.firstChild;
8300
- if (vnode.shapeFlag & 16) {
8301
- if (isTeleportDisabled(vnode.props)) {
8302
- vnode.anchor = hydrateChildren(
8303
- nextSibling(node),
8304
- vnode,
8305
- parentNode(node),
8306
- parentComponent,
8307
- parentSuspense,
8308
- slotScopeIds,
8309
- optimized
8310
- );
8311
- vnode.targetAnchor = targetNode;
8312
- } else {
8313
- vnode.anchor = nextSibling(node);
8314
- let targetAnchor = targetNode;
8315
- while (targetAnchor) {
8316
- targetAnchor = nextSibling(targetAnchor);
8317
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
8318
- vnode.targetAnchor = targetAnchor;
8319
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
8320
- break;
8321
- }
8322
- }
8323
- hydrateChildren(
8324
- targetNode,
8325
- vnode,
8326
- target,
8327
- parentComponent,
8328
- parentSuspense,
8329
- slotScopeIds,
8330
- optimized
8331
- );
8332
- }
8357
+ vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
8358
+ }
8359
+ function normalizeSuspenseSlot(s) {
8360
+ let block;
8361
+ if (isFunction(s)) {
8362
+ const trackBlock = isBlockTreeEnabled && s._c;
8363
+ if (trackBlock) {
8364
+ s._d = false;
8365
+ openBlock();
8366
+ }
8367
+ s = s();
8368
+ if (trackBlock) {
8369
+ s._d = true;
8370
+ block = currentBlock;
8371
+ closeBlock();
8333
8372
  }
8334
- updateCssVars(vnode);
8335
8373
  }
8336
- return vnode.anchor && nextSibling(vnode.anchor);
8374
+ if (isArray(s)) {
8375
+ const singleChild = filterSingleRoot(s);
8376
+ s = singleChild;
8377
+ }
8378
+ s = normalizeVNode(s);
8379
+ if (block && !s.dynamicChildren) {
8380
+ s.dynamicChildren = block.filter((c) => c !== s);
8381
+ }
8382
+ return s;
8337
8383
  }
8338
- const Teleport = TeleportImpl;
8339
- function updateCssVars(vnode) {
8340
- const ctx = vnode.ctx;
8341
- if (ctx && ctx.ut) {
8342
- let node = vnode.children[0].el;
8343
- while (node && node !== vnode.targetAnchor) {
8344
- if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
8345
- node = node.nextSibling;
8384
+ function queueEffectWithSuspense(fn, suspense) {
8385
+ if (suspense && suspense.pendingBranch) {
8386
+ if (isArray(fn)) {
8387
+ suspense.effects.push(...fn);
8388
+ } else {
8389
+ suspense.effects.push(fn);
8346
8390
  }
8347
- ctx.ut();
8391
+ } else {
8392
+ queuePostFlushCb(fn);
8393
+ }
8394
+ }
8395
+ function setActiveBranch(suspense, branch) {
8396
+ suspense.activeBranch = branch;
8397
+ const { vnode, parentComponent } = suspense;
8398
+ let el = branch.el;
8399
+ while (!el && branch.component) {
8400
+ branch = branch.component.subTree;
8401
+ el = branch.el;
8402
+ }
8403
+ vnode.el = el;
8404
+ if (parentComponent && parentComponent.subTree === vnode) {
8405
+ parentComponent.vnode.el = el;
8406
+ updateHOCHostEl(parentComponent, el);
8348
8407
  }
8349
8408
  }
8409
+ function isVNodeSuspensible(vnode) {
8410
+ const suspensible = vnode.props && vnode.props.suspensible;
8411
+ return suspensible != null && suspensible !== false;
8412
+ }
8350
8413
 
8351
8414
  const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
8352
8415
  function convertLegacyAsyncComponent(comp) {
@@ -8421,6 +8484,9 @@ function closeBlock() {
8421
8484
  let isBlockTreeEnabled = 1;
8422
8485
  function setBlockTracking(value) {
8423
8486
  isBlockTreeEnabled += value;
8487
+ if (value < 0 && currentBlock) {
8488
+ currentBlock.hasOnce = true;
8489
+ }
8424
8490
  }
8425
8491
  function setupBlock(vnode) {
8426
8492
  vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
@@ -8494,6 +8560,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8494
8560
  el: null,
8495
8561
  anchor: null,
8496
8562
  target: null,
8563
+ targetStart: null,
8497
8564
  targetAnchor: null,
8498
8565
  staticCount: 0,
8499
8566
  shapeFlag,
@@ -8607,6 +8674,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
8607
8674
  slotScopeIds: vnode.slotScopeIds,
8608
8675
  children: children,
8609
8676
  target: vnode.target,
8677
+ targetStart: vnode.targetStart,
8610
8678
  targetAnchor: vnode.targetAnchor,
8611
8679
  staticCount: vnode.staticCount,
8612
8680
  shapeFlag: vnode.shapeFlag,
@@ -8882,12 +8950,12 @@ function isStatefulComponent(instance) {
8882
8950
  return instance.vnode.shapeFlag & 4;
8883
8951
  }
8884
8952
  let isInSSRComponentSetup = false;
8885
- function setupComponent(instance, isSSR = false) {
8953
+ function setupComponent(instance, isSSR = false, optimized = false) {
8886
8954
  isSSR && setInSSRSetupState(isSSR);
8887
8955
  const { props, children } = instance.vnode;
8888
8956
  const isStateful = isStatefulComponent(instance);
8889
8957
  initProps(instance, props, isStateful, isSSR);
8890
- initSlots(instance, children);
8958
+ initSlots(instance, children, optimized);
8891
8959
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
8892
8960
  isSSR && setInSSRSetupState(false);
8893
8961
  return setupResult;
@@ -9048,51 +9116,6 @@ const computed = (getterOrOptions, debugOptions) => {
9048
9116
  return c;
9049
9117
  };
9050
9118
 
9051
- function useModel(props, name, options = EMPTY_OBJ) {
9052
- const i = getCurrentInstance();
9053
- const camelizedName = camelize(name);
9054
- const hyphenatedName = hyphenate(name);
9055
- const res = customRef((track, trigger) => {
9056
- let localValue;
9057
- watchSyncEffect(() => {
9058
- const propValue = props[name];
9059
- if (hasChanged(localValue, propValue)) {
9060
- localValue = propValue;
9061
- trigger();
9062
- }
9063
- });
9064
- return {
9065
- get() {
9066
- track();
9067
- return options.get ? options.get(localValue) : localValue;
9068
- },
9069
- set(value) {
9070
- const rawProps = i.vnode.props;
9071
- if (!(rawProps && // check if parent has passed v-model
9072
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9073
- localValue = value;
9074
- trigger();
9075
- }
9076
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
9077
- }
9078
- };
9079
- });
9080
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9081
- res[Symbol.iterator] = () => {
9082
- let i2 = 0;
9083
- return {
9084
- next() {
9085
- if (i2 < 2) {
9086
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9087
- } else {
9088
- return { done: true };
9089
- }
9090
- }
9091
- };
9092
- };
9093
- return res;
9094
- }
9095
-
9096
9119
  function h(type, propsOrChildren, children) {
9097
9120
  const l = arguments.length;
9098
9121
  if (l === 2) {
@@ -9127,7 +9150,7 @@ function withMemo(memo, render, cache, index) {
9127
9150
  }
9128
9151
  const ret = render();
9129
9152
  ret.memo = memo.slice();
9130
- ret.memoIndex = index;
9153
+ ret.cacheIndex = index;
9131
9154
  return cache[index] = ret;
9132
9155
  }
9133
9156
  function isMemoSame(cached, memo) {
@@ -9146,7 +9169,7 @@ function isMemoSame(cached, memo) {
9146
9169
  return true;
9147
9170
  }
9148
9171
 
9149
- const version = "3.4.31";
9172
+ const version = "3.4.32";
9150
9173
  const warn$1 = NOOP;
9151
9174
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9152
9175
  const devtools = void 0;
@@ -9748,12 +9771,10 @@ function compatCoerceAttr(el, key, value, instance = null) {
9748
9771
  return false;
9749
9772
  }
9750
9773
 
9751
- function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
9774
+ function patchDOMProp(el, key, value, parentComponent) {
9752
9775
  if (key === "innerHTML" || key === "textContent") {
9753
- if (prevChildren) {
9754
- unmountChildren(prevChildren, parentComponent, parentSuspense);
9755
- }
9756
- el[key] = value == null ? "" : value;
9776
+ if (value === null) return;
9777
+ el[key] = value;
9757
9778
  return;
9758
9779
  }
9759
9780
  const tag = el.tagName;
@@ -9879,7 +9900,7 @@ function patchStopImmediatePropagation(e, value) {
9879
9900
 
9880
9901
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
9881
9902
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
9882
- const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9903
+ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
9883
9904
  const isSVG = namespace === "svg";
9884
9905
  if (key === "class") {
9885
9906
  patchClass(el, nextValue, isSVG);
@@ -9890,15 +9911,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
9890
9911
  patchEvent(el, key, prevValue, nextValue, parentComponent);
9891
9912
  }
9892
9913
  } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
9893
- patchDOMProp(
9894
- el,
9895
- key,
9896
- nextValue,
9897
- prevChildren,
9898
- parentComponent,
9899
- parentSuspense,
9900
- unmountChildren
9901
- );
9914
+ patchDOMProp(el, key, nextValue, parentComponent);
9902
9915
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
9903
9916
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
9904
9917
  }
@@ -11110,12 +11123,12 @@ function createConditionalExpression(test, consequent, alternate, newline = true
11110
11123
  loc: locStub
11111
11124
  };
11112
11125
  }
11113
- function createCacheExpression(index, value, isVNode = false) {
11126
+ function createCacheExpression(index, value, isVOnce = false) {
11114
11127
  return {
11115
11128
  type: 20,
11116
11129
  index,
11117
11130
  value,
11118
- isVNode,
11131
+ isVOnce,
11119
11132
  loc: locStub
11120
11133
  };
11121
11134
  }
@@ -13368,7 +13381,7 @@ function walk(node, context, doNotHoistNode = false) {
13368
13381
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
13369
13382
  if (constantType > 0) {
13370
13383
  if (constantType >= 2) {
13371
- child.codegenNode.patchFlag = -1 + (``);
13384
+ child.codegenNode.patchFlag = -1;
13372
13385
  child.codegenNode = context.hoist(child.codegenNode);
13373
13386
  hoistedCount++;
13374
13387
  continue;
@@ -13376,8 +13389,8 @@ function walk(node, context, doNotHoistNode = false) {
13376
13389
  } else {
13377
13390
  const codegenNode = child.codegenNode;
13378
13391
  if (codegenNode.type === 13) {
13379
- const flag = getPatchFlag(codegenNode);
13380
- if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13392
+ const flag = codegenNode.patchFlag;
13393
+ if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13381
13394
  const props = getNodeProps(child);
13382
13395
  if (props) {
13383
13396
  codegenNode.props = context.hoist(props);
@@ -13441,8 +13454,7 @@ function getConstantType(node, context) {
13441
13454
  if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
13442
13455
  return 0;
13443
13456
  }
13444
- const flag = getPatchFlag(codegenNode);
13445
- if (!flag) {
13457
+ if (codegenNode.patchFlag === void 0) {
13446
13458
  let returnType2 = 3;
13447
13459
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
13448
13460
  if (generatedPropsType === 0) {
@@ -13584,10 +13596,6 @@ function getNodeProps(node) {
13584
13596
  return codegenNode.props;
13585
13597
  }
13586
13598
  }
13587
- function getPatchFlag(node) {
13588
- const flag = node.patchFlag;
13589
- return flag ? parseInt(flag, 10) : void 0;
13590
- }
13591
13599
 
13592
13600
  function createTransformContext(root, {
13593
13601
  filename = "",
@@ -13794,7 +13802,7 @@ function createRootCodegen(root, context) {
13794
13802
  helper(FRAGMENT),
13795
13803
  void 0,
13796
13804
  root.children,
13797
- patchFlag + (``),
13805
+ patchFlag,
13798
13806
  void 0,
13799
13807
  void 0,
13800
13808
  true,
@@ -14426,6 +14434,12 @@ function genVNodeCall(node, context) {
14426
14434
  disableTracking,
14427
14435
  isComponent
14428
14436
  } = node;
14437
+ let patchFlagString;
14438
+ if (patchFlag) {
14439
+ {
14440
+ patchFlagString = String(patchFlag);
14441
+ }
14442
+ }
14429
14443
  if (directives) {
14430
14444
  push(helper(WITH_DIRECTIVES) + `(`);
14431
14445
  }
@@ -14438,7 +14452,7 @@ function genVNodeCall(node, context) {
14438
14452
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
14439
14453
  push(helper(callHelper) + `(`, -2 /* None */, node);
14440
14454
  genNodeList(
14441
- genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
14455
+ genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
14442
14456
  context
14443
14457
  );
14444
14458
  push(`)`);
@@ -14572,15 +14586,16 @@ function genConditionalExpression(node, context) {
14572
14586
  function genCacheExpression(node, context) {
14573
14587
  const { push, helper, indent, deindent, newline } = context;
14574
14588
  push(`_cache[${node.index}] || (`);
14575
- if (node.isVNode) {
14589
+ if (node.isVOnce) {
14576
14590
  indent();
14577
14591
  push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
14578
14592
  newline();
14593
+ push(`(`);
14579
14594
  }
14580
14595
  push(`_cache[${node.index}] = `);
14581
14596
  genNode(node.value, context);
14582
- if (node.isVNode) {
14583
- push(`,`);
14597
+ if (node.isVOnce) {
14598
+ push(`).cacheIndex = ${node.index},`);
14584
14599
  newline();
14585
14600
  push(`${helper(SET_BLOCK_TRACKING)}(1),`);
14586
14601
  newline();
@@ -15034,7 +15049,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
15034
15049
  helper(FRAGMENT),
15035
15050
  createObjectExpression([keyProperty]),
15036
15051
  children,
15037
- patchFlag + (``),
15052
+ patchFlag,
15038
15053
  void 0,
15039
15054
  void 0,
15040
15055
  true,
@@ -15208,7 +15223,7 @@ const transformFor = createStructuralDirectiveTransform(
15208
15223
  helper(FRAGMENT),
15209
15224
  void 0,
15210
15225
  renderExp,
15211
- fragmentFlag + (``),
15226
+ fragmentFlag,
15212
15227
  void 0,
15213
15228
  void 0,
15214
15229
  true,
@@ -15248,7 +15263,7 @@ const transformFor = createStructuralDirectiveTransform(
15248
15263
  helper(FRAGMENT),
15249
15264
  keyProperty ? createObjectExpression([keyProperty]) : void 0,
15250
15265
  node.children,
15251
- 64 + (``),
15266
+ 64,
15252
15267
  void 0,
15253
15268
  void 0,
15254
15269
  true,
@@ -15697,7 +15712,6 @@ const transformElement = (node, context) => {
15697
15712
  const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
15698
15713
  let vnodeProps;
15699
15714
  let vnodeChildren;
15700
- let vnodePatchFlag;
15701
15715
  let patchFlag = 0;
15702
15716
  let vnodeDynamicProps;
15703
15717
  let dynamicPropNames;
@@ -15759,20 +15773,15 @@ const transformElement = (node, context) => {
15759
15773
  vnodeChildren = node.children;
15760
15774
  }
15761
15775
  }
15762
- if (patchFlag !== 0) {
15763
- {
15764
- vnodePatchFlag = String(patchFlag);
15765
- }
15766
- if (dynamicPropNames && dynamicPropNames.length) {
15767
- vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15768
- }
15776
+ if (dynamicPropNames && dynamicPropNames.length) {
15777
+ vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15769
15778
  }
15770
15779
  node.codegenNode = createVNodeCall(
15771
15780
  context,
15772
15781
  vnodeTag,
15773
15782
  vnodeProps,
15774
15783
  vnodeChildren,
15775
- vnodePatchFlag,
15784
+ patchFlag === 0 ? void 0 : patchFlag,
15776
15785
  vnodeDynamicProps,
15777
15786
  vnodeDirectives,
15778
15787
  !!shouldUseBlock,