@vue/runtime-core 3.5.24 → 3.5.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @vue/runtime-core v3.5.24
2
+ * @vue/runtime-core v3.5.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { pauseTracking, resetTracking, isRef, toRaw, traverse, shallowRef, readonly, isReactive, ref, isShallow, isReadonly, shallowReadArray, toReadonly, toReactive, shallowReadonly, track, reactive, shallowReactive, trigger, ReactiveEffect, watch as watch$1, customRef, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1 } from '@vue/reactivity';
6
+ import { pauseTracking, resetTracking, isRef, toRaw, traverse, watch as watch$1, shallowRef, readonly, isReactive, ref, isShallow, isReadonly, shallowReadArray, toReadonly, toReactive, shallowReadonly, track, reactive, customRef, shallowReactive, trigger, ReactiveEffect, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1 } from '@vue/reactivity';
7
7
  export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
8
- import { isString, isFunction, EMPTY_OBJ, isPromise, isArray, NOOP, getGlobalThis, extend, isBuiltInDirective, NO, hasOwn, remove, def, isOn, isReservedProp, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, normalizeCssVarValue, getEscapedCssVarName, isObject, isRegExp, invokeArrayFns, toHandlerKey, camelize, capitalize, isSymbol, isGloballyAllowed, EMPTY_ARR, hyphenate, makeMap, toRawType, hasChanged, looseToNumber, isModelListener, toNumber } from '@vue/shared';
8
+ import { isString, isFunction, EMPTY_OBJ, isPromise, isArray, NOOP, getGlobalThis, extend, isBuiltInDirective, NO, hasOwn, remove, def, isOn, isReservedProp, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, normalizeCssVarValue, getEscapedCssVarName, isObject, isRegExp, invokeArrayFns, toHandlerKey, camelize, capitalize, isSymbol, isGloballyAllowed, hyphenate, hasChanged, looseToNumber, isModelListener, EMPTY_ARR, makeMap, toRawType, toNumber } from '@vue/shared';
9
9
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
10
10
 
11
11
  const stack = [];
@@ -768,7 +768,180 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
768
768
  }
769
769
  }
770
770
 
771
- const TeleportEndKey = Symbol("_vte");
771
+ function provide(key, value) {
772
+ if (!!(process.env.NODE_ENV !== "production")) {
773
+ if (!currentInstance || currentInstance.isMounted) {
774
+ warn$1(`provide() can only be used inside setup().`);
775
+ }
776
+ }
777
+ if (currentInstance) {
778
+ let provides = currentInstance.provides;
779
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
780
+ if (parentProvides === provides) {
781
+ provides = currentInstance.provides = Object.create(parentProvides);
782
+ }
783
+ provides[key] = value;
784
+ }
785
+ }
786
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
787
+ const instance = getCurrentInstance();
788
+ if (instance || currentApp) {
789
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
790
+ if (provides && key in provides) {
791
+ return provides[key];
792
+ } else if (arguments.length > 1) {
793
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
794
+ } else if (!!(process.env.NODE_ENV !== "production")) {
795
+ warn$1(`injection "${String(key)}" not found.`);
796
+ }
797
+ } else if (!!(process.env.NODE_ENV !== "production")) {
798
+ warn$1(`inject() can only be used inside setup() or functional components.`);
799
+ }
800
+ }
801
+ function hasInjectionContext() {
802
+ return !!(getCurrentInstance() || currentApp);
803
+ }
804
+
805
+ const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
806
+ const useSSRContext = () => {
807
+ {
808
+ const ctx = inject(ssrContextKey);
809
+ if (!ctx) {
810
+ !!(process.env.NODE_ENV !== "production") && warn$1(
811
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
812
+ );
813
+ }
814
+ return ctx;
815
+ }
816
+ };
817
+
818
+ function watchEffect(effect, options) {
819
+ return doWatch(effect, null, options);
820
+ }
821
+ function watchPostEffect(effect, options) {
822
+ return doWatch(
823
+ effect,
824
+ null,
825
+ !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "post" }) : { flush: "post" }
826
+ );
827
+ }
828
+ function watchSyncEffect(effect, options) {
829
+ return doWatch(
830
+ effect,
831
+ null,
832
+ !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
833
+ );
834
+ }
835
+ function watch(source, cb, options) {
836
+ if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
837
+ warn$1(
838
+ `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
839
+ );
840
+ }
841
+ return doWatch(source, cb, options);
842
+ }
843
+ function doWatch(source, cb, options = EMPTY_OBJ) {
844
+ const { immediate, deep, flush, once } = options;
845
+ if (!!(process.env.NODE_ENV !== "production") && !cb) {
846
+ if (immediate !== void 0) {
847
+ warn$1(
848
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
849
+ );
850
+ }
851
+ if (deep !== void 0) {
852
+ warn$1(
853
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
854
+ );
855
+ }
856
+ if (once !== void 0) {
857
+ warn$1(
858
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
859
+ );
860
+ }
861
+ }
862
+ const baseWatchOptions = extend({}, options);
863
+ if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
864
+ const runsImmediately = cb && immediate || !cb && flush !== "post";
865
+ let ssrCleanup;
866
+ if (isInSSRComponentSetup) {
867
+ if (flush === "sync") {
868
+ const ctx = useSSRContext();
869
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
870
+ } else if (!runsImmediately) {
871
+ const watchStopHandle = () => {
872
+ };
873
+ watchStopHandle.stop = NOOP;
874
+ watchStopHandle.resume = NOOP;
875
+ watchStopHandle.pause = NOOP;
876
+ return watchStopHandle;
877
+ }
878
+ }
879
+ const instance = currentInstance;
880
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
881
+ let isPre = false;
882
+ if (flush === "post") {
883
+ baseWatchOptions.scheduler = (job) => {
884
+ queuePostRenderEffect(job, instance && instance.suspense);
885
+ };
886
+ } else if (flush !== "sync") {
887
+ isPre = true;
888
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
889
+ if (isFirstRun) {
890
+ job();
891
+ } else {
892
+ queueJob(job);
893
+ }
894
+ };
895
+ }
896
+ baseWatchOptions.augmentJob = (job) => {
897
+ if (cb) {
898
+ job.flags |= 4;
899
+ }
900
+ if (isPre) {
901
+ job.flags |= 2;
902
+ if (instance) {
903
+ job.id = instance.uid;
904
+ job.i = instance;
905
+ }
906
+ }
907
+ };
908
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
909
+ if (isInSSRComponentSetup) {
910
+ if (ssrCleanup) {
911
+ ssrCleanup.push(watchHandle);
912
+ } else if (runsImmediately) {
913
+ watchHandle();
914
+ }
915
+ }
916
+ return watchHandle;
917
+ }
918
+ function instanceWatch(source, value, options) {
919
+ const publicThis = this.proxy;
920
+ const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
921
+ let cb;
922
+ if (isFunction(value)) {
923
+ cb = value;
924
+ } else {
925
+ cb = value.handler;
926
+ options = value;
927
+ }
928
+ const reset = setCurrentInstance(this);
929
+ const res = doWatch(getter, cb.bind(publicThis), options);
930
+ reset();
931
+ return res;
932
+ }
933
+ function createPathGetter(ctx, path) {
934
+ const segments = path.split(".");
935
+ return () => {
936
+ let cur = ctx;
937
+ for (let i = 0; i < segments.length && cur; i++) {
938
+ cur = cur[segments[i]];
939
+ }
940
+ return cur;
941
+ };
942
+ }
943
+
944
+ const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
772
945
  const isTeleport = (type) => type.__isTeleport;
773
946
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
774
947
  const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
@@ -1128,8 +1301,8 @@ function prepareAnchor(target, vnode, createText, insert) {
1128
1301
  return targetAnchor;
1129
1302
  }
1130
1303
 
1131
- const leaveCbKey = Symbol("_leaveCb");
1132
- const enterCbKey = Symbol("_enterCb");
1304
+ const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
1305
+ const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1133
1306
  function useTransitionState() {
1134
1307
  const state = {
1135
1308
  isMounted: false,
@@ -2678,7 +2851,9 @@ const KeepAliveImpl = {
2678
2851
  }
2679
2852
  function pruneCache(filter) {
2680
2853
  cache.forEach((vnode, key) => {
2681
- const name = getComponentName(vnode.type);
2854
+ const name = getComponentName(
2855
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
2856
+ );
2682
2857
  if (name && !filter(name)) {
2683
2858
  pruneCacheEntry(key);
2684
2859
  }
@@ -2905,7 +3080,7 @@ const DIRECTIVES = "directives";
2905
3080
  function resolveComponent(name, maybeSelfReference) {
2906
3081
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2907
3082
  }
2908
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3083
+ const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
2909
3084
  function resolveDynamicComponent(component) {
2910
3085
  if (isString(component)) {
2911
3086
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -3129,7 +3304,6 @@ const PublicInstanceProxyHandlers = {
3129
3304
  if (!!(process.env.NODE_ENV !== "production") && key === "__isVue") {
3130
3305
  return true;
3131
3306
  }
3132
- let normalizedProps;
3133
3307
  if (key[0] !== "$") {
3134
3308
  const n = accessCache[key];
3135
3309
  if (n !== void 0) {
@@ -3149,11 +3323,7 @@ const PublicInstanceProxyHandlers = {
3149
3323
  } else if (__VUE_OPTIONS_API__ && data !== EMPTY_OBJ && hasOwn(data, key)) {
3150
3324
  accessCache[key] = 2 /* DATA */;
3151
3325
  return data[key];
3152
- } else if (
3153
- // only cache other properties when instance has declared (thus stable)
3154
- // props
3155
- (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
3156
- ) {
3326
+ } else if (hasOwn(props, key)) {
3157
3327
  accessCache[key] = 3 /* PROPS */;
3158
3328
  return props[key];
3159
3329
  } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
@@ -3238,10 +3408,10 @@ const PublicInstanceProxyHandlers = {
3238
3408
  return true;
3239
3409
  },
3240
3410
  has({
3241
- _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
3411
+ _: { data, setupState, accessCache, ctx, appContext, props, type }
3242
3412
  }, key) {
3243
- let normalizedProps, cssModules;
3244
- return !!(accessCache[key] || __VUE_OPTIONS_API__ && data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
3413
+ let cssModules;
3414
+ return !!(accessCache[key] || __VUE_OPTIONS_API__ && data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
3245
3415
  },
3246
3416
  defineProperty(target, key, descriptor) {
3247
3417
  if (descriptor.get != null) {
@@ -4078,1078 +4248,1547 @@ If you want to remount the same app, move your app creation logic into a factory
4078
4248
  }
4079
4249
  let currentApp = null;
4080
4250
 
4081
- function provide(key, value) {
4082
- if (!currentInstance) {
4083
- if (!!(process.env.NODE_ENV !== "production")) {
4084
- warn$1(`provide() can only be used inside setup().`);
4085
- }
4086
- } else {
4087
- let provides = currentInstance.provides;
4088
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
4089
- if (parentProvides === provides) {
4090
- provides = currentInstance.provides = Object.create(parentProvides);
4091
- }
4092
- provides[key] = value;
4251
+ function useModel(props, name, options = EMPTY_OBJ) {
4252
+ const i = getCurrentInstance();
4253
+ if (!!(process.env.NODE_ENV !== "production") && !i) {
4254
+ warn$1(`useModel() called without active instance.`);
4255
+ return ref();
4093
4256
  }
4094
- }
4095
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
4096
- const instance = getCurrentInstance();
4097
- if (instance || currentApp) {
4098
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
4099
- if (provides && key in provides) {
4100
- return provides[key];
4101
- } else if (arguments.length > 1) {
4102
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
4103
- } else if (!!(process.env.NODE_ENV !== "production")) {
4104
- warn$1(`injection "${String(key)}" not found.`);
4105
- }
4106
- } else if (!!(process.env.NODE_ENV !== "production")) {
4107
- warn$1(`inject() can only be used inside setup() or functional components.`);
4257
+ const camelizedName = camelize(name);
4258
+ if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][camelizedName]) {
4259
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
4260
+ return ref();
4108
4261
  }
4262
+ const hyphenatedName = hyphenate(name);
4263
+ const modifiers = getModelModifiers(props, camelizedName);
4264
+ const res = customRef((track, trigger) => {
4265
+ let localValue;
4266
+ let prevSetValue = EMPTY_OBJ;
4267
+ let prevEmittedValue;
4268
+ watchSyncEffect(() => {
4269
+ const propValue = props[camelizedName];
4270
+ if (hasChanged(localValue, propValue)) {
4271
+ localValue = propValue;
4272
+ trigger();
4273
+ }
4274
+ });
4275
+ return {
4276
+ get() {
4277
+ track();
4278
+ return options.get ? options.get(localValue) : localValue;
4279
+ },
4280
+ set(value) {
4281
+ const emittedValue = options.set ? options.set(value) : value;
4282
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
4283
+ return;
4284
+ }
4285
+ const rawProps = i.vnode.props;
4286
+ if (!(rawProps && // check if parent has passed v-model
4287
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
4288
+ localValue = value;
4289
+ trigger();
4290
+ }
4291
+ i.emit(`update:${name}`, emittedValue);
4292
+ if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
4293
+ trigger();
4294
+ }
4295
+ prevSetValue = value;
4296
+ prevEmittedValue = emittedValue;
4297
+ }
4298
+ };
4299
+ });
4300
+ res[Symbol.iterator] = () => {
4301
+ let i2 = 0;
4302
+ return {
4303
+ next() {
4304
+ if (i2 < 2) {
4305
+ return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
4306
+ } else {
4307
+ return { done: true };
4308
+ }
4309
+ }
4310
+ };
4311
+ };
4312
+ return res;
4109
4313
  }
4110
- function hasInjectionContext() {
4111
- return !!(getCurrentInstance() || currentApp);
4112
- }
4113
-
4114
- const internalObjectProto = {};
4115
- const createInternalObject = () => Object.create(internalObjectProto);
4116
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
4314
+ const getModelModifiers = (props, modelName) => {
4315
+ return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
4316
+ };
4117
4317
 
4118
- function initProps(instance, rawProps, isStateful, isSSR = false) {
4119
- const props = {};
4120
- const attrs = createInternalObject();
4121
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
4122
- setFullProps(instance, rawProps, props, attrs);
4123
- for (const key in instance.propsOptions[0]) {
4124
- if (!(key in props)) {
4125
- props[key] = void 0;
4126
- }
4127
- }
4318
+ function emit(instance, event, ...rawArgs) {
4319
+ if (instance.isUnmounted) return;
4320
+ const props = instance.vnode.props || EMPTY_OBJ;
4128
4321
  if (!!(process.env.NODE_ENV !== "production")) {
4129
- validateProps(rawProps || {}, props, instance);
4130
- }
4131
- if (isStateful) {
4132
- instance.props = isSSR ? props : shallowReactive(props);
4133
- } else {
4134
- if (!instance.type.props) {
4135
- instance.props = attrs;
4136
- } else {
4137
- instance.props = props;
4138
- }
4139
- }
4140
- instance.attrs = attrs;
4141
- }
4142
- function isInHmrContext(instance) {
4143
- while (instance) {
4144
- if (instance.type.__hmrId) return true;
4145
- instance = instance.parent;
4146
- }
4147
- }
4148
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
4149
- const {
4150
- props,
4151
- attrs,
4152
- vnode: { patchFlag }
4153
- } = instance;
4154
- const rawCurrentProps = toRaw(props);
4155
- const [options] = instance.propsOptions;
4156
- let hasAttrsChanged = false;
4157
- if (
4158
- // always force full diff in dev
4159
- // - #1942 if hmr is enabled with sfc component
4160
- // - vite#872 non-sfc component used by sfc component
4161
- !(!!(process.env.NODE_ENV !== "production") && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
4162
- ) {
4163
- if (patchFlag & 8) {
4164
- const propsToUpdate = instance.vnode.dynamicProps;
4165
- for (let i = 0; i < propsToUpdate.length; i++) {
4166
- let key = propsToUpdate[i];
4167
- if (isEmitListener(instance.emitsOptions, key)) {
4168
- continue;
4322
+ const {
4323
+ emitsOptions,
4324
+ propsOptions: [propsOptions]
4325
+ } = instance;
4326
+ if (emitsOptions) {
4327
+ if (!(event in emitsOptions) && true) {
4328
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
4329
+ warn$1(
4330
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
4331
+ );
4169
4332
  }
4170
- const value = rawProps[key];
4171
- if (options) {
4172
- if (hasOwn(attrs, key)) {
4173
- if (value !== attrs[key]) {
4174
- attrs[key] = value;
4175
- hasAttrsChanged = true;
4176
- }
4177
- } else {
4178
- const camelizedKey = camelize(key);
4179
- props[camelizedKey] = resolvePropValue(
4180
- options,
4181
- rawCurrentProps,
4182
- camelizedKey,
4183
- value,
4184
- instance,
4185
- false
4333
+ } else {
4334
+ const validator = emitsOptions[event];
4335
+ if (isFunction(validator)) {
4336
+ const isValid = validator(...rawArgs);
4337
+ if (!isValid) {
4338
+ warn$1(
4339
+ `Invalid event arguments: event validation failed for event "${event}".`
4186
4340
  );
4187
4341
  }
4188
- } else {
4189
- if (value !== attrs[key]) {
4190
- attrs[key] = value;
4191
- hasAttrsChanged = true;
4192
- }
4193
4342
  }
4194
4343
  }
4195
4344
  }
4196
- } else {
4197
- if (setFullProps(instance, rawProps, props, attrs)) {
4198
- hasAttrsChanged = true;
4199
- }
4200
- let kebabKey;
4201
- for (const key in rawCurrentProps) {
4202
- if (!rawProps || // for camelCase
4203
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
4204
- // and converted to camelCase (#955)
4205
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
4206
- if (options) {
4207
- if (rawPrevProps && // for camelCase
4208
- (rawPrevProps[key] !== void 0 || // for kebab-case
4209
- rawPrevProps[kebabKey] !== void 0)) {
4210
- props[key] = resolvePropValue(
4211
- options,
4212
- rawCurrentProps,
4213
- key,
4214
- void 0,
4215
- instance,
4216
- true
4217
- );
4218
- }
4219
- } else {
4220
- delete props[key];
4221
- }
4222
- }
4345
+ }
4346
+ let args = rawArgs;
4347
+ const isModelListener = event.startsWith("update:");
4348
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
4349
+ if (modifiers) {
4350
+ if (modifiers.trim) {
4351
+ args = rawArgs.map((a) => isString(a) ? a.trim() : a);
4223
4352
  }
4224
- if (attrs !== rawCurrentProps) {
4225
- for (const key in attrs) {
4226
- if (!rawProps || !hasOwn(rawProps, key) && true) {
4227
- delete attrs[key];
4228
- hasAttrsChanged = true;
4229
- }
4230
- }
4353
+ if (modifiers.number) {
4354
+ args = rawArgs.map(looseToNumber);
4231
4355
  }
4232
4356
  }
4233
- if (hasAttrsChanged) {
4234
- trigger(instance.attrs, "set", "");
4357
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4358
+ devtoolsComponentEmit(instance, event, args);
4235
4359
  }
4236
4360
  if (!!(process.env.NODE_ENV !== "production")) {
4237
- validateProps(rawProps || {}, props, instance);
4361
+ const lowerCaseEvent = event.toLowerCase();
4362
+ if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
4363
+ warn$1(
4364
+ `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
4365
+ instance,
4366
+ instance.type
4367
+ )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
4368
+ event
4369
+ )}" instead of "${event}".`
4370
+ );
4371
+ }
4372
+ }
4373
+ let handlerName;
4374
+ let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
4375
+ props[handlerName = toHandlerKey(camelize(event))];
4376
+ if (!handler && isModelListener) {
4377
+ handler = props[handlerName = toHandlerKey(hyphenate(event))];
4378
+ }
4379
+ if (handler) {
4380
+ callWithAsyncErrorHandling(
4381
+ handler,
4382
+ instance,
4383
+ 6,
4384
+ args
4385
+ );
4386
+ }
4387
+ const onceHandler = props[handlerName + `Once`];
4388
+ if (onceHandler) {
4389
+ if (!instance.emitted) {
4390
+ instance.emitted = {};
4391
+ } else if (instance.emitted[handlerName]) {
4392
+ return;
4393
+ }
4394
+ instance.emitted[handlerName] = true;
4395
+ callWithAsyncErrorHandling(
4396
+ onceHandler,
4397
+ instance,
4398
+ 6,
4399
+ args
4400
+ );
4238
4401
  }
4239
4402
  }
4240
- function setFullProps(instance, rawProps, props, attrs) {
4241
- const [options, needCastKeys] = instance.propsOptions;
4242
- let hasAttrsChanged = false;
4243
- let rawCastValues;
4244
- if (rawProps) {
4245
- for (let key in rawProps) {
4246
- if (isReservedProp(key)) {
4247
- continue;
4248
- }
4249
- const value = rawProps[key];
4250
- let camelKey;
4251
- if (options && hasOwn(options, camelKey = camelize(key))) {
4252
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
4253
- props[camelKey] = value;
4254
- } else {
4255
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
4256
- }
4257
- } else if (!isEmitListener(instance.emitsOptions, key)) {
4258
- if (!(key in attrs) || value !== attrs[key]) {
4259
- attrs[key] = value;
4260
- hasAttrsChanged = true;
4261
- }
4403
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
4404
+ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
4405
+ const cache = __VUE_OPTIONS_API__ && asMixin ? mixinEmitsCache : appContext.emitsCache;
4406
+ const cached = cache.get(comp);
4407
+ if (cached !== void 0) {
4408
+ return cached;
4409
+ }
4410
+ const raw = comp.emits;
4411
+ let normalized = {};
4412
+ let hasExtends = false;
4413
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
4414
+ const extendEmits = (raw2) => {
4415
+ const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
4416
+ if (normalizedFromExtend) {
4417
+ hasExtends = true;
4418
+ extend(normalized, normalizedFromExtend);
4262
4419
  }
4420
+ };
4421
+ if (!asMixin && appContext.mixins.length) {
4422
+ appContext.mixins.forEach(extendEmits);
4423
+ }
4424
+ if (comp.extends) {
4425
+ extendEmits(comp.extends);
4426
+ }
4427
+ if (comp.mixins) {
4428
+ comp.mixins.forEach(extendEmits);
4263
4429
  }
4264
4430
  }
4265
- if (needCastKeys) {
4266
- const rawCurrentProps = toRaw(props);
4267
- const castValues = rawCastValues || EMPTY_OBJ;
4268
- for (let i = 0; i < needCastKeys.length; i++) {
4269
- const key = needCastKeys[i];
4270
- props[key] = resolvePropValue(
4271
- options,
4272
- rawCurrentProps,
4273
- key,
4274
- castValues[key],
4275
- instance,
4276
- !hasOwn(castValues, key)
4277
- );
4431
+ if (!raw && !hasExtends) {
4432
+ if (isObject(comp)) {
4433
+ cache.set(comp, null);
4278
4434
  }
4435
+ return null;
4279
4436
  }
4280
- return hasAttrsChanged;
4281
- }
4282
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
4283
- const opt = options[key];
4284
- if (opt != null) {
4285
- const hasDefault = hasOwn(opt, "default");
4286
- if (hasDefault && value === void 0) {
4287
- const defaultValue = opt.default;
4288
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
4289
- const { propsDefaults } = instance;
4290
- if (key in propsDefaults) {
4291
- value = propsDefaults[key];
4292
- } else {
4293
- const reset = setCurrentInstance(instance);
4294
- value = propsDefaults[key] = defaultValue.call(
4295
- null,
4296
- props
4297
- );
4298
- reset();
4299
- }
4300
- } else {
4301
- value = defaultValue;
4302
- }
4303
- if (instance.ce) {
4304
- instance.ce._setProp(key, value);
4305
- }
4306
- }
4307
- if (opt[0 /* shouldCast */]) {
4308
- if (isAbsent && !hasDefault) {
4309
- value = false;
4310
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
4311
- value = true;
4312
- }
4313
- }
4437
+ if (isArray(raw)) {
4438
+ raw.forEach((key) => normalized[key] = null);
4439
+ } else {
4440
+ extend(normalized, raw);
4314
4441
  }
4315
- return value;
4316
- }
4317
- const mixinPropsCache = /* @__PURE__ */ new WeakMap();
4318
- function normalizePropsOptions(comp, appContext, asMixin = false) {
4319
- const cache = __VUE_OPTIONS_API__ && asMixin ? mixinPropsCache : appContext.propsCache;
4320
- const cached = cache.get(comp);
4321
- if (cached) {
4322
- return cached;
4442
+ if (isObject(comp)) {
4443
+ cache.set(comp, normalized);
4323
4444
  }
4324
- const raw = comp.props;
4325
- const normalized = {};
4326
- const needCastKeys = [];
4327
- let hasExtends = false;
4328
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
4329
- const extendProps = (raw2) => {
4330
- hasExtends = true;
4331
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
4332
- extend(normalized, props);
4333
- if (keys) needCastKeys.push(...keys);
4334
- };
4335
- if (!asMixin && appContext.mixins.length) {
4336
- appContext.mixins.forEach(extendProps);
4337
- }
4338
- if (comp.extends) {
4339
- extendProps(comp.extends);
4340
- }
4341
- if (comp.mixins) {
4342
- comp.mixins.forEach(extendProps);
4343
- }
4445
+ return normalized;
4446
+ }
4447
+ function isEmitListener(options, key) {
4448
+ if (!options || !isOn(key)) {
4449
+ return false;
4344
4450
  }
4345
- if (!raw && !hasExtends) {
4346
- if (isObject(comp)) {
4347
- cache.set(comp, EMPTY_ARR);
4348
- }
4349
- return EMPTY_ARR;
4451
+ key = key.slice(2).replace(/Once$/, "");
4452
+ return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
4453
+ }
4454
+
4455
+ let accessedAttrs = false;
4456
+ function markAttrsAccessed() {
4457
+ accessedAttrs = true;
4458
+ }
4459
+ function renderComponentRoot(instance) {
4460
+ const {
4461
+ type: Component,
4462
+ vnode,
4463
+ proxy,
4464
+ withProxy,
4465
+ propsOptions: [propsOptions],
4466
+ slots,
4467
+ attrs,
4468
+ emit,
4469
+ render,
4470
+ renderCache,
4471
+ props,
4472
+ data,
4473
+ setupState,
4474
+ ctx,
4475
+ inheritAttrs
4476
+ } = instance;
4477
+ const prev = setCurrentRenderingInstance(instance);
4478
+ let result;
4479
+ let fallthroughAttrs;
4480
+ if (!!(process.env.NODE_ENV !== "production")) {
4481
+ accessedAttrs = false;
4350
4482
  }
4351
- if (isArray(raw)) {
4352
- for (let i = 0; i < raw.length; i++) {
4353
- if (!!(process.env.NODE_ENV !== "production") && !isString(raw[i])) {
4354
- warn$1(`props must be strings when using array syntax.`, raw[i]);
4355
- }
4356
- const normalizedKey = camelize(raw[i]);
4357
- if (validatePropName(normalizedKey)) {
4358
- normalized[normalizedKey] = EMPTY_OBJ;
4483
+ try {
4484
+ if (vnode.shapeFlag & 4) {
4485
+ const proxyToUse = withProxy || proxy;
4486
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
4487
+ get(target, key, receiver) {
4488
+ warn$1(
4489
+ `Property '${String(
4490
+ key
4491
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
4492
+ );
4493
+ return Reflect.get(target, key, receiver);
4494
+ }
4495
+ }) : proxyToUse;
4496
+ result = normalizeVNode(
4497
+ render.call(
4498
+ thisProxy,
4499
+ proxyToUse,
4500
+ renderCache,
4501
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
4502
+ setupState,
4503
+ data,
4504
+ ctx
4505
+ )
4506
+ );
4507
+ fallthroughAttrs = attrs;
4508
+ } else {
4509
+ const render2 = Component;
4510
+ if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
4511
+ markAttrsAccessed();
4359
4512
  }
4513
+ result = normalizeVNode(
4514
+ render2.length > 1 ? render2(
4515
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
4516
+ !!(process.env.NODE_ENV !== "production") ? {
4517
+ get attrs() {
4518
+ markAttrsAccessed();
4519
+ return shallowReadonly(attrs);
4520
+ },
4521
+ slots,
4522
+ emit
4523
+ } : { attrs, slots, emit }
4524
+ ) : render2(
4525
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
4526
+ null
4527
+ )
4528
+ );
4529
+ fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
4360
4530
  }
4361
- } else if (raw) {
4362
- if (!!(process.env.NODE_ENV !== "production") && !isObject(raw)) {
4363
- warn$1(`invalid props options`, raw);
4364
- }
4365
- for (const key in raw) {
4366
- const normalizedKey = camelize(key);
4367
- if (validatePropName(normalizedKey)) {
4368
- const opt = raw[key];
4369
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
4370
- const propType = prop.type;
4371
- let shouldCast = false;
4372
- let shouldCastTrue = true;
4373
- if (isArray(propType)) {
4374
- for (let index = 0; index < propType.length; ++index) {
4375
- const type = propType[index];
4376
- const typeName = isFunction(type) && type.name;
4377
- if (typeName === "Boolean") {
4378
- shouldCast = true;
4379
- break;
4380
- } else if (typeName === "String") {
4381
- shouldCastTrue = false;
4531
+ } catch (err) {
4532
+ blockStack.length = 0;
4533
+ handleError(err, instance, 1);
4534
+ result = createVNode(Comment);
4535
+ }
4536
+ let root = result;
4537
+ let setRoot = void 0;
4538
+ if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
4539
+ [root, setRoot] = getChildRoot(result);
4540
+ }
4541
+ if (fallthroughAttrs && inheritAttrs !== false) {
4542
+ const keys = Object.keys(fallthroughAttrs);
4543
+ const { shapeFlag } = root;
4544
+ if (keys.length) {
4545
+ if (shapeFlag & (1 | 6)) {
4546
+ if (propsOptions && keys.some(isModelListener)) {
4547
+ fallthroughAttrs = filterModelListeners(
4548
+ fallthroughAttrs,
4549
+ propsOptions
4550
+ );
4551
+ }
4552
+ root = cloneVNode(root, fallthroughAttrs, false, true);
4553
+ } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
4554
+ const allAttrs = Object.keys(attrs);
4555
+ const eventAttrs = [];
4556
+ const extraAttrs = [];
4557
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
4558
+ const key = allAttrs[i];
4559
+ if (isOn(key)) {
4560
+ if (!isModelListener(key)) {
4561
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
4382
4562
  }
4563
+ } else {
4564
+ extraAttrs.push(key);
4383
4565
  }
4384
- } else {
4385
- shouldCast = isFunction(propType) && propType.name === "Boolean";
4386
4566
  }
4387
- prop[0 /* shouldCast */] = shouldCast;
4388
- prop[1 /* shouldCastTrue */] = shouldCastTrue;
4389
- if (shouldCast || hasOwn(prop, "default")) {
4390
- needCastKeys.push(normalizedKey);
4567
+ if (extraAttrs.length) {
4568
+ warn$1(
4569
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
4570
+ );
4571
+ }
4572
+ if (eventAttrs.length) {
4573
+ warn$1(
4574
+ `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
4575
+ );
4391
4576
  }
4392
4577
  }
4393
4578
  }
4394
4579
  }
4395
- const res = [normalized, needCastKeys];
4396
- if (isObject(comp)) {
4397
- cache.set(comp, res);
4580
+ if (vnode.dirs) {
4581
+ if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
4582
+ warn$1(
4583
+ `Runtime directive used on component with non-element root node. The directives will not function as intended.`
4584
+ );
4585
+ }
4586
+ root = cloneVNode(root, null, false, true);
4587
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
4398
4588
  }
4399
- return res;
4400
- }
4401
- function validatePropName(key) {
4402
- if (key[0] !== "$" && !isReservedProp(key)) {
4403
- return true;
4404
- } else if (!!(process.env.NODE_ENV !== "production")) {
4405
- warn$1(`Invalid prop name: "${key}" is a reserved property.`);
4589
+ if (vnode.transition) {
4590
+ if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
4591
+ warn$1(
4592
+ `Component inside <Transition> renders non-element root node that cannot be animated.`
4593
+ );
4594
+ }
4595
+ setTransitionHooks(root, vnode.transition);
4406
4596
  }
4407
- return false;
4408
- }
4409
- function getType(ctor) {
4410
- if (ctor === null) {
4411
- return "null";
4412
- }
4413
- if (typeof ctor === "function") {
4414
- return ctor.name || "";
4415
- } else if (typeof ctor === "object") {
4416
- const name = ctor.constructor && ctor.constructor.name;
4417
- return name || "";
4418
- }
4419
- return "";
4420
- }
4421
- function validateProps(rawProps, props, instance) {
4422
- const resolvedValues = toRaw(props);
4423
- const options = instance.propsOptions[0];
4424
- const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
4425
- for (const key in options) {
4426
- let opt = options[key];
4427
- if (opt == null) continue;
4428
- validateProp(
4429
- key,
4430
- resolvedValues[key],
4431
- opt,
4432
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
4433
- !camelizePropsKey.includes(key)
4434
- );
4597
+ if (!!(process.env.NODE_ENV !== "production") && setRoot) {
4598
+ setRoot(root);
4599
+ } else {
4600
+ result = root;
4435
4601
  }
4602
+ setCurrentRenderingInstance(prev);
4603
+ return result;
4436
4604
  }
4437
- function validateProp(name, value, prop, props, isAbsent) {
4438
- const { type, required, validator, skipCheck } = prop;
4439
- if (required && isAbsent) {
4440
- warn$1('Missing required prop: "' + name + '"');
4441
- return;
4442
- }
4443
- if (value == null && !required) {
4444
- return;
4605
+ const getChildRoot = (vnode) => {
4606
+ const rawChildren = vnode.children;
4607
+ const dynamicChildren = vnode.dynamicChildren;
4608
+ const childRoot = filterSingleRoot(rawChildren, false);
4609
+ if (!childRoot) {
4610
+ return [vnode, void 0];
4611
+ } else if (!!(process.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
4612
+ return getChildRoot(childRoot);
4445
4613
  }
4446
- if (type != null && type !== true && !skipCheck) {
4447
- let isValid = false;
4448
- const types = isArray(type) ? type : [type];
4449
- const expectedTypes = [];
4450
- for (let i = 0; i < types.length && !isValid; i++) {
4451
- const { valid, expectedType } = assertType(value, types[i]);
4452
- expectedTypes.push(expectedType || "");
4453
- isValid = valid;
4614
+ const index = rawChildren.indexOf(childRoot);
4615
+ const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
4616
+ const setRoot = (updatedRoot) => {
4617
+ rawChildren[index] = updatedRoot;
4618
+ if (dynamicChildren) {
4619
+ if (dynamicIndex > -1) {
4620
+ dynamicChildren[dynamicIndex] = updatedRoot;
4621
+ } else if (updatedRoot.patchFlag > 0) {
4622
+ vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
4623
+ }
4454
4624
  }
4455
- if (!isValid) {
4456
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
4625
+ };
4626
+ return [normalizeVNode(childRoot), setRoot];
4627
+ };
4628
+ function filterSingleRoot(children, recurse = true) {
4629
+ let singleRoot;
4630
+ for (let i = 0; i < children.length; i++) {
4631
+ const child = children[i];
4632
+ if (isVNode(child)) {
4633
+ if (child.type !== Comment || child.children === "v-if") {
4634
+ if (singleRoot) {
4635
+ return;
4636
+ } else {
4637
+ singleRoot = child;
4638
+ if (!!(process.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
4639
+ return filterSingleRoot(singleRoot.children);
4640
+ }
4641
+ }
4642
+ }
4643
+ } else {
4457
4644
  return;
4458
4645
  }
4459
4646
  }
4460
- if (validator && !validator(value, props)) {
4461
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
4462
- }
4647
+ return singleRoot;
4463
4648
  }
4464
- const isSimpleType = /* @__PURE__ */ makeMap(
4465
- "String,Number,Boolean,Function,Symbol,BigInt"
4466
- );
4467
- function assertType(value, type) {
4468
- let valid;
4469
- const expectedType = getType(type);
4470
- if (expectedType === "null") {
4471
- valid = value === null;
4472
- } else if (isSimpleType(expectedType)) {
4473
- const t = typeof value;
4474
- valid = t === expectedType.toLowerCase();
4475
- if (!valid && t === "object") {
4476
- valid = value instanceof type;
4649
+ const getFunctionalFallthrough = (attrs) => {
4650
+ let res;
4651
+ for (const key in attrs) {
4652
+ if (key === "class" || key === "style" || isOn(key)) {
4653
+ (res || (res = {}))[key] = attrs[key];
4477
4654
  }
4478
- } else if (expectedType === "Object") {
4479
- valid = isObject(value);
4480
- } else if (expectedType === "Array") {
4481
- valid = isArray(value);
4482
- } else {
4483
- valid = value instanceof type;
4484
4655
  }
4485
- return {
4486
- valid,
4487
- expectedType
4488
- };
4489
- }
4490
- function getInvalidTypeMessage(name, value, expectedTypes) {
4491
- if (expectedTypes.length === 0) {
4492
- return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
4656
+ return res;
4657
+ };
4658
+ const filterModelListeners = (attrs, props) => {
4659
+ const res = {};
4660
+ for (const key in attrs) {
4661
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
4662
+ res[key] = attrs[key];
4663
+ }
4493
4664
  }
4494
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
4495
- const expectedType = expectedTypes[0];
4496
- const receivedType = toRawType(value);
4497
- const expectedValue = styleValue(value, expectedType);
4498
- const receivedValue = styleValue(value, receivedType);
4499
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
4500
- message += ` with value ${expectedValue}`;
4665
+ return res;
4666
+ };
4667
+ const isElementRoot = (vnode) => {
4668
+ return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
4669
+ };
4670
+ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
4671
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
4672
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
4673
+ const emits = component.emitsOptions;
4674
+ if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
4675
+ return true;
4501
4676
  }
4502
- message += `, got ${receivedType} `;
4503
- if (isExplicable(receivedType)) {
4504
- message += `with value ${receivedValue}.`;
4677
+ if (nextVNode.dirs || nextVNode.transition) {
4678
+ return true;
4505
4679
  }
4506
- return message;
4507
- }
4508
- function styleValue(value, type) {
4509
- if (type === "String") {
4510
- return `"${value}"`;
4511
- } else if (type === "Number") {
4512
- return `${Number(value)}`;
4680
+ if (optimized && patchFlag >= 0) {
4681
+ if (patchFlag & 1024) {
4682
+ return true;
4683
+ }
4684
+ if (patchFlag & 16) {
4685
+ if (!prevProps) {
4686
+ return !!nextProps;
4687
+ }
4688
+ return hasPropsChanged(prevProps, nextProps, emits);
4689
+ } else if (patchFlag & 8) {
4690
+ const dynamicProps = nextVNode.dynamicProps;
4691
+ for (let i = 0; i < dynamicProps.length; i++) {
4692
+ const key = dynamicProps[i];
4693
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
4694
+ return true;
4695
+ }
4696
+ }
4697
+ }
4513
4698
  } else {
4514
- return `${value}`;
4699
+ if (prevChildren || nextChildren) {
4700
+ if (!nextChildren || !nextChildren.$stable) {
4701
+ return true;
4702
+ }
4703
+ }
4704
+ if (prevProps === nextProps) {
4705
+ return false;
4706
+ }
4707
+ if (!prevProps) {
4708
+ return !!nextProps;
4709
+ }
4710
+ if (!nextProps) {
4711
+ return true;
4712
+ }
4713
+ return hasPropsChanged(prevProps, nextProps, emits);
4515
4714
  }
4715
+ return false;
4516
4716
  }
4517
- function isExplicable(type) {
4518
- const explicitTypes = ["string", "number", "boolean"];
4519
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
4520
- }
4521
- function isBoolean(...args) {
4522
- return args.some((elem) => elem.toLowerCase() === "boolean");
4523
- }
4524
-
4525
- const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
4526
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
4527
- const normalizeSlot = (key, rawSlot, ctx) => {
4528
- if (rawSlot._n) {
4529
- return rawSlot;
4717
+ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
4718
+ const nextKeys = Object.keys(nextProps);
4719
+ if (nextKeys.length !== Object.keys(prevProps).length) {
4720
+ return true;
4530
4721
  }
4531
- const normalized = withCtx((...args) => {
4532
- if (!!(process.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4533
- warn$1(
4534
- `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
4535
- );
4722
+ for (let i = 0; i < nextKeys.length; i++) {
4723
+ const key = nextKeys[i];
4724
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
4725
+ return true;
4536
4726
  }
4537
- return normalizeSlotValue(rawSlot(...args));
4538
- }, ctx);
4539
- normalized._c = false;
4540
- return normalized;
4541
- };
4542
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
4543
- const ctx = rawSlots._ctx;
4544
- for (const key in rawSlots) {
4545
- if (isInternalKey(key)) continue;
4546
- const value = rawSlots[key];
4547
- if (isFunction(value)) {
4548
- slots[key] = normalizeSlot(key, value, ctx);
4549
- } else if (value != null) {
4550
- if (!!(process.env.NODE_ENV !== "production") && true) {
4551
- warn$1(
4552
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
4553
- );
4554
- }
4555
- const normalized = normalizeSlotValue(value);
4556
- slots[key] = () => normalized;
4727
+ }
4728
+ return false;
4729
+ }
4730
+ function updateHOCHostEl({ vnode, parent }, el) {
4731
+ while (parent) {
4732
+ const root = parent.subTree;
4733
+ if (root.suspense && root.suspense.activeBranch === vnode) {
4734
+ root.el = vnode.el;
4735
+ }
4736
+ if (root === vnode) {
4737
+ (vnode = parent.vnode).el = el;
4738
+ parent = parent.parent;
4739
+ } else {
4740
+ break;
4557
4741
  }
4558
4742
  }
4559
- };
4560
- const normalizeVNodeSlots = (instance, children) => {
4561
- if (!!(process.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
4562
- warn$1(
4563
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
4564
- );
4565
- }
4566
- const normalized = normalizeSlotValue(children);
4567
- instance.slots.default = () => normalized;
4568
- };
4569
- const assignSlots = (slots, children, optimized) => {
4570
- for (const key in children) {
4571
- if (optimized || !isInternalKey(key)) {
4572
- slots[key] = children[key];
4743
+ }
4744
+
4745
+ const internalObjectProto = {};
4746
+ const createInternalObject = () => Object.create(internalObjectProto);
4747
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
4748
+
4749
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
4750
+ const props = {};
4751
+ const attrs = createInternalObject();
4752
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
4753
+ setFullProps(instance, rawProps, props, attrs);
4754
+ for (const key in instance.propsOptions[0]) {
4755
+ if (!(key in props)) {
4756
+ props[key] = void 0;
4573
4757
  }
4574
4758
  }
4575
- };
4576
- const initSlots = (instance, children, optimized) => {
4577
- const slots = instance.slots = createInternalObject();
4578
- if (instance.vnode.shapeFlag & 32) {
4579
- const type = children._;
4580
- if (type) {
4581
- assignSlots(slots, children, optimized);
4582
- if (optimized) {
4583
- def(slots, "_", type, true);
4584
- }
4759
+ if (!!(process.env.NODE_ENV !== "production")) {
4760
+ validateProps(rawProps || {}, props, instance);
4761
+ }
4762
+ if (isStateful) {
4763
+ instance.props = isSSR ? props : shallowReactive(props);
4764
+ } else {
4765
+ if (!instance.type.props) {
4766
+ instance.props = attrs;
4585
4767
  } else {
4586
- normalizeObjectSlots(children, slots);
4768
+ instance.props = props;
4587
4769
  }
4588
- } else if (children) {
4589
- normalizeVNodeSlots(instance, children);
4590
4770
  }
4591
- };
4592
- const updateSlots = (instance, children, optimized) => {
4593
- const { vnode, slots } = instance;
4594
- let needDeletionCheck = true;
4595
- let deletionComparisonTarget = EMPTY_OBJ;
4596
- if (vnode.shapeFlag & 32) {
4597
- const type = children._;
4598
- if (type) {
4599
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
4600
- assignSlots(slots, children, optimized);
4601
- trigger(instance, "set", "$slots");
4602
- } else if (optimized && type === 1) {
4603
- needDeletionCheck = false;
4604
- } else {
4605
- assignSlots(slots, children, optimized);
4771
+ instance.attrs = attrs;
4772
+ }
4773
+ function isInHmrContext(instance) {
4774
+ while (instance) {
4775
+ if (instance.type.__hmrId) return true;
4776
+ instance = instance.parent;
4777
+ }
4778
+ }
4779
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
4780
+ const {
4781
+ props,
4782
+ attrs,
4783
+ vnode: { patchFlag }
4784
+ } = instance;
4785
+ const rawCurrentProps = toRaw(props);
4786
+ const [options] = instance.propsOptions;
4787
+ let hasAttrsChanged = false;
4788
+ if (
4789
+ // always force full diff in dev
4790
+ // - #1942 if hmr is enabled with sfc component
4791
+ // - vite#872 non-sfc component used by sfc component
4792
+ !(!!(process.env.NODE_ENV !== "production") && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
4793
+ ) {
4794
+ if (patchFlag & 8) {
4795
+ const propsToUpdate = instance.vnode.dynamicProps;
4796
+ for (let i = 0; i < propsToUpdate.length; i++) {
4797
+ let key = propsToUpdate[i];
4798
+ if (isEmitListener(instance.emitsOptions, key)) {
4799
+ continue;
4800
+ }
4801
+ const value = rawProps[key];
4802
+ if (options) {
4803
+ if (hasOwn(attrs, key)) {
4804
+ if (value !== attrs[key]) {
4805
+ attrs[key] = value;
4806
+ hasAttrsChanged = true;
4807
+ }
4808
+ } else {
4809
+ const camelizedKey = camelize(key);
4810
+ props[camelizedKey] = resolvePropValue(
4811
+ options,
4812
+ rawCurrentProps,
4813
+ camelizedKey,
4814
+ value,
4815
+ instance,
4816
+ false
4817
+ );
4818
+ }
4819
+ } else {
4820
+ if (value !== attrs[key]) {
4821
+ attrs[key] = value;
4822
+ hasAttrsChanged = true;
4823
+ }
4824
+ }
4606
4825
  }
4607
- } else {
4608
- needDeletionCheck = !children.$stable;
4609
- normalizeObjectSlots(children, slots);
4610
4826
  }
4611
- deletionComparisonTarget = children;
4612
- } else if (children) {
4613
- normalizeVNodeSlots(instance, children);
4614
- deletionComparisonTarget = { default: 1 };
4615
- }
4616
- if (needDeletionCheck) {
4617
- for (const key in slots) {
4618
- if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
4619
- delete slots[key];
4827
+ } else {
4828
+ if (setFullProps(instance, rawProps, props, attrs)) {
4829
+ hasAttrsChanged = true;
4830
+ }
4831
+ let kebabKey;
4832
+ for (const key in rawCurrentProps) {
4833
+ if (!rawProps || // for camelCase
4834
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
4835
+ // and converted to camelCase (#955)
4836
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
4837
+ if (options) {
4838
+ if (rawPrevProps && // for camelCase
4839
+ (rawPrevProps[key] !== void 0 || // for kebab-case
4840
+ rawPrevProps[kebabKey] !== void 0)) {
4841
+ props[key] = resolvePropValue(
4842
+ options,
4843
+ rawCurrentProps,
4844
+ key,
4845
+ void 0,
4846
+ instance,
4847
+ true
4848
+ );
4849
+ }
4850
+ } else {
4851
+ delete props[key];
4852
+ }
4853
+ }
4854
+ }
4855
+ if (attrs !== rawCurrentProps) {
4856
+ for (const key in attrs) {
4857
+ if (!rawProps || !hasOwn(rawProps, key) && true) {
4858
+ delete attrs[key];
4859
+ hasAttrsChanged = true;
4860
+ }
4620
4861
  }
4621
4862
  }
4622
4863
  }
4623
- };
4624
-
4625
- let supported;
4626
- let perf;
4627
- function startMeasure(instance, type) {
4628
- if (instance.appContext.config.performance && isSupported()) {
4629
- perf.mark(`vue-${type}-${instance.uid}`);
4630
- }
4631
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4632
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4633
- }
4634
- }
4635
- function endMeasure(instance, type) {
4636
- if (instance.appContext.config.performance && isSupported()) {
4637
- const startTag = `vue-${type}-${instance.uid}`;
4638
- const endTag = startTag + `:end`;
4639
- const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
4640
- perf.mark(endTag);
4641
- perf.measure(measureName, startTag, endTag);
4642
- perf.clearMeasures(measureName);
4643
- perf.clearMarks(startTag);
4644
- perf.clearMarks(endTag);
4864
+ if (hasAttrsChanged) {
4865
+ trigger(instance.attrs, "set", "");
4645
4866
  }
4646
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4647
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4867
+ if (!!(process.env.NODE_ENV !== "production")) {
4868
+ validateProps(rawProps || {}, props, instance);
4648
4869
  }
4649
4870
  }
4650
- function isSupported() {
4651
- if (supported !== void 0) {
4652
- return supported;
4871
+ function setFullProps(instance, rawProps, props, attrs) {
4872
+ const [options, needCastKeys] = instance.propsOptions;
4873
+ let hasAttrsChanged = false;
4874
+ let rawCastValues;
4875
+ if (rawProps) {
4876
+ for (let key in rawProps) {
4877
+ if (isReservedProp(key)) {
4878
+ continue;
4879
+ }
4880
+ const value = rawProps[key];
4881
+ let camelKey;
4882
+ if (options && hasOwn(options, camelKey = camelize(key))) {
4883
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
4884
+ props[camelKey] = value;
4885
+ } else {
4886
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
4887
+ }
4888
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
4889
+ if (!(key in attrs) || value !== attrs[key]) {
4890
+ attrs[key] = value;
4891
+ hasAttrsChanged = true;
4892
+ }
4893
+ }
4894
+ }
4653
4895
  }
4654
- if (typeof window !== "undefined" && window.performance) {
4655
- supported = true;
4656
- perf = window.performance;
4657
- } else {
4658
- supported = false;
4896
+ if (needCastKeys) {
4897
+ const rawCurrentProps = toRaw(props);
4898
+ const castValues = rawCastValues || EMPTY_OBJ;
4899
+ for (let i = 0; i < needCastKeys.length; i++) {
4900
+ const key = needCastKeys[i];
4901
+ props[key] = resolvePropValue(
4902
+ options,
4903
+ rawCurrentProps,
4904
+ key,
4905
+ castValues[key],
4906
+ instance,
4907
+ !hasOwn(castValues, key)
4908
+ );
4909
+ }
4659
4910
  }
4660
- return supported;
4911
+ return hasAttrsChanged;
4661
4912
  }
4662
-
4663
- function initFeatureFlags() {
4664
- const needWarn = [];
4665
- if (typeof __VUE_OPTIONS_API__ !== "boolean") {
4666
- !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_OPTIONS_API__`);
4667
- getGlobalThis().__VUE_OPTIONS_API__ = true;
4668
- }
4669
- if (typeof __VUE_PROD_DEVTOOLS__ !== "boolean") {
4670
- !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
4671
- getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
4672
- }
4673
- if (typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ !== "boolean") {
4674
- !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`);
4675
- getGlobalThis().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = false;
4676
- }
4677
- if (!!(process.env.NODE_ENV !== "production") && needWarn.length) {
4678
- const multi = needWarn.length > 1;
4679
- console.warn(
4680
- `Feature flag${multi ? `s` : ``} ${needWarn.join(", ")} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
4681
-
4682
- For more details, see https://link.vuejs.org/feature-flags.`
4683
- );
4913
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4914
+ const opt = options[key];
4915
+ if (opt != null) {
4916
+ const hasDefault = hasOwn(opt, "default");
4917
+ if (hasDefault && value === void 0) {
4918
+ const defaultValue = opt.default;
4919
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
4920
+ const { propsDefaults } = instance;
4921
+ if (key in propsDefaults) {
4922
+ value = propsDefaults[key];
4923
+ } else {
4924
+ const reset = setCurrentInstance(instance);
4925
+ value = propsDefaults[key] = defaultValue.call(
4926
+ null,
4927
+ props
4928
+ );
4929
+ reset();
4930
+ }
4931
+ } else {
4932
+ value = defaultValue;
4933
+ }
4934
+ if (instance.ce) {
4935
+ instance.ce._setProp(key, value);
4936
+ }
4937
+ }
4938
+ if (opt[0 /* shouldCast */]) {
4939
+ if (isAbsent && !hasDefault) {
4940
+ value = false;
4941
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
4942
+ value = true;
4943
+ }
4944
+ }
4684
4945
  }
4946
+ return value;
4685
4947
  }
4686
-
4687
- const queuePostRenderEffect = queueEffectWithSuspense ;
4688
- function createRenderer(options) {
4689
- return baseCreateRenderer(options);
4690
- }
4691
- function createHydrationRenderer(options) {
4692
- return baseCreateRenderer(options, createHydrationFunctions);
4693
- }
4694
- function baseCreateRenderer(options, createHydrationFns) {
4695
- {
4696
- initFeatureFlags();
4948
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
4949
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
4950
+ const cache = __VUE_OPTIONS_API__ && asMixin ? mixinPropsCache : appContext.propsCache;
4951
+ const cached = cache.get(comp);
4952
+ if (cached) {
4953
+ return cached;
4697
4954
  }
4698
- const target = getGlobalThis();
4699
- target.__VUE__ = true;
4700
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4701
- setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
4955
+ const raw = comp.props;
4956
+ const normalized = {};
4957
+ const needCastKeys = [];
4958
+ let hasExtends = false;
4959
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
4960
+ const extendProps = (raw2) => {
4961
+ hasExtends = true;
4962
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
4963
+ extend(normalized, props);
4964
+ if (keys) needCastKeys.push(...keys);
4965
+ };
4966
+ if (!asMixin && appContext.mixins.length) {
4967
+ appContext.mixins.forEach(extendProps);
4968
+ }
4969
+ if (comp.extends) {
4970
+ extendProps(comp.extends);
4971
+ }
4972
+ if (comp.mixins) {
4973
+ comp.mixins.forEach(extendProps);
4974
+ }
4702
4975
  }
4703
- const {
4704
- insert: hostInsert,
4705
- remove: hostRemove,
4706
- patchProp: hostPatchProp,
4707
- createElement: hostCreateElement,
4708
- createText: hostCreateText,
4709
- createComment: hostCreateComment,
4710
- setText: hostSetText,
4711
- setElementText: hostSetElementText,
4712
- parentNode: hostParentNode,
4713
- nextSibling: hostNextSibling,
4714
- setScopeId: hostSetScopeId = NOOP,
4715
- insertStaticContent: hostInsertStaticContent
4716
- } = options;
4717
- const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!(process.env.NODE_ENV !== "production") && isHmrUpdating ? false : !!n2.dynamicChildren) => {
4718
- if (n1 === n2) {
4719
- return;
4976
+ if (!raw && !hasExtends) {
4977
+ if (isObject(comp)) {
4978
+ cache.set(comp, EMPTY_ARR);
4720
4979
  }
4721
- if (n1 && !isSameVNodeType(n1, n2)) {
4722
- anchor = getNextHostNode(n1);
4723
- unmount(n1, parentComponent, parentSuspense, true);
4724
- n1 = null;
4980
+ return EMPTY_ARR;
4981
+ }
4982
+ if (isArray(raw)) {
4983
+ for (let i = 0; i < raw.length; i++) {
4984
+ if (!!(process.env.NODE_ENV !== "production") && !isString(raw[i])) {
4985
+ warn$1(`props must be strings when using array syntax.`, raw[i]);
4986
+ }
4987
+ const normalizedKey = camelize(raw[i]);
4988
+ if (validatePropName(normalizedKey)) {
4989
+ normalized[normalizedKey] = EMPTY_OBJ;
4990
+ }
4725
4991
  }
4726
- if (n2.patchFlag === -2) {
4727
- optimized = false;
4728
- n2.dynamicChildren = null;
4992
+ } else if (raw) {
4993
+ if (!!(process.env.NODE_ENV !== "production") && !isObject(raw)) {
4994
+ warn$1(`invalid props options`, raw);
4729
4995
  }
4730
- const { type, ref, shapeFlag } = n2;
4731
- switch (type) {
4732
- case Text:
4733
- processText(n1, n2, container, anchor);
4734
- break;
4735
- case Comment:
4736
- processCommentNode(n1, n2, container, anchor);
4737
- break;
4738
- case Static:
4739
- if (n1 == null) {
4740
- mountStaticNode(n2, container, anchor, namespace);
4741
- } else if (!!(process.env.NODE_ENV !== "production")) {
4742
- patchStaticNode(n1, n2, container, namespace);
4996
+ for (const key in raw) {
4997
+ const normalizedKey = camelize(key);
4998
+ if (validatePropName(normalizedKey)) {
4999
+ const opt = raw[key];
5000
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5001
+ const propType = prop.type;
5002
+ let shouldCast = false;
5003
+ let shouldCastTrue = true;
5004
+ if (isArray(propType)) {
5005
+ for (let index = 0; index < propType.length; ++index) {
5006
+ const type = propType[index];
5007
+ const typeName = isFunction(type) && type.name;
5008
+ if (typeName === "Boolean") {
5009
+ shouldCast = true;
5010
+ break;
5011
+ } else if (typeName === "String") {
5012
+ shouldCastTrue = false;
5013
+ }
5014
+ }
5015
+ } else {
5016
+ shouldCast = isFunction(propType) && propType.name === "Boolean";
4743
5017
  }
4744
- break;
4745
- case Fragment:
4746
- processFragment(
4747
- n1,
4748
- n2,
4749
- container,
4750
- anchor,
4751
- parentComponent,
4752
- parentSuspense,
4753
- namespace,
4754
- slotScopeIds,
4755
- optimized
4756
- );
4757
- break;
4758
- default:
4759
- if (shapeFlag & 1) {
4760
- processElement(
4761
- n1,
4762
- n2,
4763
- container,
4764
- anchor,
4765
- parentComponent,
4766
- parentSuspense,
4767
- namespace,
4768
- slotScopeIds,
4769
- optimized
4770
- );
4771
- } else if (shapeFlag & 6) {
4772
- processComponent(
4773
- n1,
4774
- n2,
4775
- container,
4776
- anchor,
4777
- parentComponent,
4778
- parentSuspense,
4779
- namespace,
4780
- slotScopeIds,
4781
- optimized
4782
- );
4783
- } else if (shapeFlag & 64) {
4784
- type.process(
4785
- n1,
4786
- n2,
4787
- container,
4788
- anchor,
4789
- parentComponent,
4790
- parentSuspense,
4791
- namespace,
4792
- slotScopeIds,
4793
- optimized,
4794
- internals
4795
- );
4796
- } else if (shapeFlag & 128) {
4797
- type.process(
4798
- n1,
4799
- n2,
4800
- container,
4801
- anchor,
4802
- parentComponent,
4803
- parentSuspense,
4804
- namespace,
4805
- slotScopeIds,
4806
- optimized,
4807
- internals
4808
- );
4809
- } else if (!!(process.env.NODE_ENV !== "production")) {
4810
- warn$1("Invalid VNode type:", type, `(${typeof type})`);
5018
+ prop[0 /* shouldCast */] = shouldCast;
5019
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
5020
+ if (shouldCast || hasOwn(prop, "default")) {
5021
+ needCastKeys.push(normalizedKey);
4811
5022
  }
4812
- }
4813
- if (ref != null && parentComponent) {
4814
- setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
4815
- } else if (ref == null && n1 && n1.ref != null) {
4816
- setRef(n1.ref, null, parentSuspense, n1, true);
4817
- }
4818
- };
4819
- const processText = (n1, n2, container, anchor) => {
4820
- if (n1 == null) {
4821
- hostInsert(
4822
- n2.el = hostCreateText(n2.children),
4823
- container,
4824
- anchor
4825
- );
4826
- } else {
4827
- const el = n2.el = n1.el;
4828
- if (n2.children !== n1.children) {
4829
- hostSetText(el, n2.children);
4830
5023
  }
4831
5024
  }
4832
- };
4833
- const processCommentNode = (n1, n2, container, anchor) => {
4834
- if (n1 == null) {
4835
- hostInsert(
4836
- n2.el = hostCreateComment(n2.children || ""),
4837
- container,
4838
- anchor
4839
- );
4840
- } else {
4841
- n2.el = n1.el;
4842
- }
4843
- };
4844
- const mountStaticNode = (n2, container, anchor, namespace) => {
4845
- [n2.el, n2.anchor] = hostInsertStaticContent(
4846
- n2.children,
4847
- container,
4848
- anchor,
4849
- namespace,
4850
- n2.el,
4851
- n2.anchor
5025
+ }
5026
+ const res = [normalized, needCastKeys];
5027
+ if (isObject(comp)) {
5028
+ cache.set(comp, res);
5029
+ }
5030
+ return res;
5031
+ }
5032
+ function validatePropName(key) {
5033
+ if (key[0] !== "$" && !isReservedProp(key)) {
5034
+ return true;
5035
+ } else if (!!(process.env.NODE_ENV !== "production")) {
5036
+ warn$1(`Invalid prop name: "${key}" is a reserved property.`);
5037
+ }
5038
+ return false;
5039
+ }
5040
+ function getType(ctor) {
5041
+ if (ctor === null) {
5042
+ return "null";
5043
+ }
5044
+ if (typeof ctor === "function") {
5045
+ return ctor.name || "";
5046
+ } else if (typeof ctor === "object") {
5047
+ const name = ctor.constructor && ctor.constructor.name;
5048
+ return name || "";
5049
+ }
5050
+ return "";
5051
+ }
5052
+ function validateProps(rawProps, props, instance) {
5053
+ const resolvedValues = toRaw(props);
5054
+ const options = instance.propsOptions[0];
5055
+ const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
5056
+ for (const key in options) {
5057
+ let opt = options[key];
5058
+ if (opt == null) continue;
5059
+ validateProp(
5060
+ key,
5061
+ resolvedValues[key],
5062
+ opt,
5063
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
5064
+ !camelizePropsKey.includes(key)
4852
5065
  );
4853
- };
4854
- const patchStaticNode = (n1, n2, container, namespace) => {
4855
- if (n2.children !== n1.children) {
4856
- const anchor = hostNextSibling(n1.anchor);
4857
- removeStaticNode(n1);
4858
- [n2.el, n2.anchor] = hostInsertStaticContent(
4859
- n2.children,
4860
- container,
4861
- anchor,
4862
- namespace
4863
- );
4864
- } else {
4865
- n2.el = n1.el;
4866
- n2.anchor = n1.anchor;
5066
+ }
5067
+ }
5068
+ function validateProp(name, value, prop, props, isAbsent) {
5069
+ const { type, required, validator, skipCheck } = prop;
5070
+ if (required && isAbsent) {
5071
+ warn$1('Missing required prop: "' + name + '"');
5072
+ return;
5073
+ }
5074
+ if (value == null && !required) {
5075
+ return;
5076
+ }
5077
+ if (type != null && type !== true && !skipCheck) {
5078
+ let isValid = false;
5079
+ const types = isArray(type) ? type : [type];
5080
+ const expectedTypes = [];
5081
+ for (let i = 0; i < types.length && !isValid; i++) {
5082
+ const { valid, expectedType } = assertType(value, types[i]);
5083
+ expectedTypes.push(expectedType || "");
5084
+ isValid = valid;
4867
5085
  }
4868
- };
4869
- const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
4870
- let next;
4871
- while (el && el !== anchor) {
4872
- next = hostNextSibling(el);
4873
- hostInsert(el, container, nextSibling);
4874
- el = next;
5086
+ if (!isValid) {
5087
+ warn$1(getInvalidTypeMessage(name, value, expectedTypes));
5088
+ return;
4875
5089
  }
4876
- hostInsert(anchor, container, nextSibling);
4877
- };
4878
- const removeStaticNode = ({ el, anchor }) => {
4879
- let next;
4880
- while (el && el !== anchor) {
4881
- next = hostNextSibling(el);
4882
- hostRemove(el);
4883
- el = next;
5090
+ }
5091
+ if (validator && !validator(value, props)) {
5092
+ warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
5093
+ }
5094
+ }
5095
+ const isSimpleType = /* @__PURE__ */ makeMap(
5096
+ "String,Number,Boolean,Function,Symbol,BigInt"
5097
+ );
5098
+ function assertType(value, type) {
5099
+ let valid;
5100
+ const expectedType = getType(type);
5101
+ if (expectedType === "null") {
5102
+ valid = value === null;
5103
+ } else if (isSimpleType(expectedType)) {
5104
+ const t = typeof value;
5105
+ valid = t === expectedType.toLowerCase();
5106
+ if (!valid && t === "object") {
5107
+ valid = value instanceof type;
4884
5108
  }
4885
- hostRemove(anchor);
5109
+ } else if (expectedType === "Object") {
5110
+ valid = isObject(value);
5111
+ } else if (expectedType === "Array") {
5112
+ valid = isArray(value);
5113
+ } else {
5114
+ valid = value instanceof type;
5115
+ }
5116
+ return {
5117
+ valid,
5118
+ expectedType
4886
5119
  };
4887
- const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4888
- if (n2.type === "svg") {
4889
- namespace = "svg";
4890
- } else if (n2.type === "math") {
4891
- namespace = "mathml";
4892
- }
4893
- if (n1 == null) {
4894
- mountElement(
4895
- n2,
4896
- container,
4897
- anchor,
4898
- parentComponent,
4899
- parentSuspense,
4900
- namespace,
4901
- slotScopeIds,
4902
- optimized
5120
+ }
5121
+ function getInvalidTypeMessage(name, value, expectedTypes) {
5122
+ if (expectedTypes.length === 0) {
5123
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5124
+ }
5125
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5126
+ const expectedType = expectedTypes[0];
5127
+ const receivedType = toRawType(value);
5128
+ const expectedValue = styleValue(value, expectedType);
5129
+ const receivedValue = styleValue(value, receivedType);
5130
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5131
+ message += ` with value ${expectedValue}`;
5132
+ }
5133
+ message += `, got ${receivedType} `;
5134
+ if (isExplicable(receivedType)) {
5135
+ message += `with value ${receivedValue}.`;
5136
+ }
5137
+ return message;
5138
+ }
5139
+ function styleValue(value, type) {
5140
+ if (type === "String") {
5141
+ return `"${value}"`;
5142
+ } else if (type === "Number") {
5143
+ return `${Number(value)}`;
5144
+ } else {
5145
+ return `${value}`;
5146
+ }
5147
+ }
5148
+ function isExplicable(type) {
5149
+ const explicitTypes = ["string", "number", "boolean"];
5150
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
5151
+ }
5152
+ function isBoolean(...args) {
5153
+ return args.some((elem) => elem.toLowerCase() === "boolean");
5154
+ }
5155
+
5156
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
5157
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5158
+ const normalizeSlot = (key, rawSlot, ctx) => {
5159
+ if (rawSlot._n) {
5160
+ return rawSlot;
5161
+ }
5162
+ const normalized = withCtx((...args) => {
5163
+ if (!!(process.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
5164
+ warn$1(
5165
+ `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
4903
5166
  );
4904
- } else {
4905
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
4906
- try {
4907
- if (customElement) {
4908
- customElement._beginPatch();
4909
- }
4910
- patchElement(
4911
- n1,
4912
- n2,
4913
- parentComponent,
4914
- parentSuspense,
4915
- namespace,
4916
- slotScopeIds,
4917
- optimized
5167
+ }
5168
+ return normalizeSlotValue(rawSlot(...args));
5169
+ }, ctx);
5170
+ normalized._c = false;
5171
+ return normalized;
5172
+ };
5173
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
5174
+ const ctx = rawSlots._ctx;
5175
+ for (const key in rawSlots) {
5176
+ if (isInternalKey(key)) continue;
5177
+ const value = rawSlots[key];
5178
+ if (isFunction(value)) {
5179
+ slots[key] = normalizeSlot(key, value, ctx);
5180
+ } else if (value != null) {
5181
+ if (!!(process.env.NODE_ENV !== "production") && true) {
5182
+ warn$1(
5183
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
4918
5184
  );
4919
- } finally {
4920
- if (customElement) {
4921
- customElement._endPatch();
4922
- }
4923
5185
  }
5186
+ const normalized = normalizeSlotValue(value);
5187
+ slots[key] = () => normalized;
4924
5188
  }
4925
- };
4926
- const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4927
- let el;
4928
- let vnodeHook;
4929
- const { props, shapeFlag, transition, dirs } = vnode;
4930
- el = vnode.el = hostCreateElement(
4931
- vnode.type,
4932
- namespace,
4933
- props && props.is,
4934
- props
5189
+ }
5190
+ };
5191
+ const normalizeVNodeSlots = (instance, children) => {
5192
+ if (!!(process.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
5193
+ warn$1(
5194
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
4935
5195
  );
4936
- if (shapeFlag & 8) {
4937
- hostSetElementText(el, vnode.children);
4938
- } else if (shapeFlag & 16) {
4939
- mountChildren(
4940
- vnode.children,
4941
- el,
4942
- null,
4943
- parentComponent,
4944
- parentSuspense,
4945
- resolveChildrenNamespace(vnode, namespace),
4946
- slotScopeIds,
4947
- optimized
4948
- );
4949
- }
4950
- if (dirs) {
4951
- invokeDirectiveHook(vnode, null, parentComponent, "created");
5196
+ }
5197
+ const normalized = normalizeSlotValue(children);
5198
+ instance.slots.default = () => normalized;
5199
+ };
5200
+ const assignSlots = (slots, children, optimized) => {
5201
+ for (const key in children) {
5202
+ if (optimized || !isInternalKey(key)) {
5203
+ slots[key] = children[key];
4952
5204
  }
4953
- setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
4954
- if (props) {
4955
- for (const key in props) {
4956
- if (key !== "value" && !isReservedProp(key)) {
4957
- hostPatchProp(el, key, null, props[key], namespace, parentComponent);
4958
- }
4959
- }
4960
- if ("value" in props) {
4961
- hostPatchProp(el, "value", null, props.value, namespace);
4962
- }
4963
- if (vnodeHook = props.onVnodeBeforeMount) {
4964
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
5205
+ }
5206
+ };
5207
+ const initSlots = (instance, children, optimized) => {
5208
+ const slots = instance.slots = createInternalObject();
5209
+ if (instance.vnode.shapeFlag & 32) {
5210
+ const type = children._;
5211
+ if (type) {
5212
+ assignSlots(slots, children, optimized);
5213
+ if (optimized) {
5214
+ def(slots, "_", type, true);
4965
5215
  }
5216
+ } else {
5217
+ normalizeObjectSlots(children, slots);
4966
5218
  }
4967
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4968
- def(el, "__vnode", vnode, true);
4969
- def(el, "__vueParentComponent", parentComponent, true);
4970
- }
4971
- if (dirs) {
4972
- invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4973
- }
4974
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
4975
- if (needCallTransitionHooks) {
4976
- transition.beforeEnter(el);
4977
- }
4978
- hostInsert(el, container, anchor);
4979
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
4980
- queuePostRenderEffect(() => {
4981
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4982
- needCallTransitionHooks && transition.enter(el);
4983
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4984
- }, parentSuspense);
4985
- }
4986
- };
4987
- const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
4988
- if (scopeId) {
4989
- hostSetScopeId(el, scopeId);
4990
- }
4991
- if (slotScopeIds) {
4992
- for (let i = 0; i < slotScopeIds.length; i++) {
4993
- hostSetScopeId(el, slotScopeIds[i]);
5219
+ } else if (children) {
5220
+ normalizeVNodeSlots(instance, children);
5221
+ }
5222
+ };
5223
+ const updateSlots = (instance, children, optimized) => {
5224
+ const { vnode, slots } = instance;
5225
+ let needDeletionCheck = true;
5226
+ let deletionComparisonTarget = EMPTY_OBJ;
5227
+ if (vnode.shapeFlag & 32) {
5228
+ const type = children._;
5229
+ if (type) {
5230
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
5231
+ assignSlots(slots, children, optimized);
5232
+ trigger(instance, "set", "$slots");
5233
+ } else if (optimized && type === 1) {
5234
+ needDeletionCheck = false;
5235
+ } else {
5236
+ assignSlots(slots, children, optimized);
4994
5237
  }
5238
+ } else {
5239
+ needDeletionCheck = !children.$stable;
5240
+ normalizeObjectSlots(children, slots);
4995
5241
  }
4996
- if (parentComponent) {
4997
- let subTree = parentComponent.subTree;
4998
- if (!!(process.env.NODE_ENV !== "production") && subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
4999
- subTree = filterSingleRoot(subTree.children) || subTree;
5000
- }
5001
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
5002
- const parentVNode = parentComponent.vnode;
5003
- setScopeId(
5004
- el,
5005
- parentVNode,
5006
- parentVNode.scopeId,
5007
- parentVNode.slotScopeIds,
5008
- parentComponent.parent
5009
- );
5242
+ deletionComparisonTarget = children;
5243
+ } else if (children) {
5244
+ normalizeVNodeSlots(instance, children);
5245
+ deletionComparisonTarget = { default: 1 };
5246
+ }
5247
+ if (needDeletionCheck) {
5248
+ for (const key in slots) {
5249
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
5250
+ delete slots[key];
5010
5251
  }
5011
5252
  }
5012
- };
5013
- const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
5014
- for (let i = start; i < children.length; i++) {
5015
- const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
5016
- patch(
5017
- null,
5018
- child,
5019
- container,
5020
- anchor,
5021
- parentComponent,
5022
- parentSuspense,
5023
- namespace,
5024
- slotScopeIds,
5025
- optimized
5026
- );
5027
- }
5028
- };
5029
- const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5030
- const el = n2.el = n1.el;
5031
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5032
- el.__vnode = n2;
5033
- }
5034
- let { patchFlag, dynamicChildren, dirs } = n2;
5035
- patchFlag |= n1.patchFlag & 16;
5036
- const oldProps = n1.props || EMPTY_OBJ;
5037
- const newProps = n2.props || EMPTY_OBJ;
5038
- let vnodeHook;
5039
- parentComponent && toggleRecurse(parentComponent, false);
5040
- if (vnodeHook = newProps.onVnodeBeforeUpdate) {
5041
- invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5253
+ }
5254
+ };
5255
+
5256
+ let supported;
5257
+ let perf;
5258
+ function startMeasure(instance, type) {
5259
+ if (instance.appContext.config.performance && isSupported()) {
5260
+ perf.mark(`vue-${type}-${instance.uid}`);
5261
+ }
5262
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5263
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
5264
+ }
5265
+ }
5266
+ function endMeasure(instance, type) {
5267
+ if (instance.appContext.config.performance && isSupported()) {
5268
+ const startTag = `vue-${type}-${instance.uid}`;
5269
+ const endTag = startTag + `:end`;
5270
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
5271
+ perf.mark(endTag);
5272
+ perf.measure(measureName, startTag, endTag);
5273
+ perf.clearMeasures(measureName);
5274
+ perf.clearMarks(startTag);
5275
+ perf.clearMarks(endTag);
5276
+ }
5277
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5278
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
5279
+ }
5280
+ }
5281
+ function isSupported() {
5282
+ if (supported !== void 0) {
5283
+ return supported;
5284
+ }
5285
+ if (typeof window !== "undefined" && window.performance) {
5286
+ supported = true;
5287
+ perf = window.performance;
5288
+ } else {
5289
+ supported = false;
5290
+ }
5291
+ return supported;
5292
+ }
5293
+
5294
+ function initFeatureFlags() {
5295
+ const needWarn = [];
5296
+ if (typeof __VUE_OPTIONS_API__ !== "boolean") {
5297
+ !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_OPTIONS_API__`);
5298
+ getGlobalThis().__VUE_OPTIONS_API__ = true;
5299
+ }
5300
+ if (typeof __VUE_PROD_DEVTOOLS__ !== "boolean") {
5301
+ !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
5302
+ getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
5303
+ }
5304
+ if (typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ !== "boolean") {
5305
+ !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`);
5306
+ getGlobalThis().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = false;
5307
+ }
5308
+ if (!!(process.env.NODE_ENV !== "production") && needWarn.length) {
5309
+ const multi = needWarn.length > 1;
5310
+ console.warn(
5311
+ `Feature flag${multi ? `s` : ``} ${needWarn.join(", ")} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
5312
+
5313
+ For more details, see https://link.vuejs.org/feature-flags.`
5314
+ );
5315
+ }
5316
+ }
5317
+
5318
+ const queuePostRenderEffect = queueEffectWithSuspense ;
5319
+ function createRenderer(options) {
5320
+ return baseCreateRenderer(options);
5321
+ }
5322
+ function createHydrationRenderer(options) {
5323
+ return baseCreateRenderer(options, createHydrationFunctions);
5324
+ }
5325
+ function baseCreateRenderer(options, createHydrationFns) {
5326
+ {
5327
+ initFeatureFlags();
5328
+ }
5329
+ const target = getGlobalThis();
5330
+ target.__VUE__ = true;
5331
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5332
+ setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
5333
+ }
5334
+ const {
5335
+ insert: hostInsert,
5336
+ remove: hostRemove,
5337
+ patchProp: hostPatchProp,
5338
+ createElement: hostCreateElement,
5339
+ createText: hostCreateText,
5340
+ createComment: hostCreateComment,
5341
+ setText: hostSetText,
5342
+ setElementText: hostSetElementText,
5343
+ parentNode: hostParentNode,
5344
+ nextSibling: hostNextSibling,
5345
+ setScopeId: hostSetScopeId = NOOP,
5346
+ insertStaticContent: hostInsertStaticContent
5347
+ } = options;
5348
+ const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!(process.env.NODE_ENV !== "production") && isHmrUpdating ? false : !!n2.dynamicChildren) => {
5349
+ if (n1 === n2) {
5350
+ return;
5042
5351
  }
5043
- if (dirs) {
5044
- invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
5352
+ if (n1 && !isSameVNodeType(n1, n2)) {
5353
+ anchor = getNextHostNode(n1);
5354
+ unmount(n1, parentComponent, parentSuspense, true);
5355
+ n1 = null;
5045
5356
  }
5046
- parentComponent && toggleRecurse(parentComponent, true);
5047
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
5048
- patchFlag = 0;
5357
+ if (n2.patchFlag === -2) {
5049
5358
  optimized = false;
5050
- dynamicChildren = null;
5051
- }
5052
- if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
5053
- hostSetElementText(el, "");
5359
+ n2.dynamicChildren = null;
5054
5360
  }
5055
- if (dynamicChildren) {
5056
- patchBlockChildren(
5057
- n1.dynamicChildren,
5058
- dynamicChildren,
5059
- el,
5060
- parentComponent,
5061
- parentSuspense,
5062
- resolveChildrenNamespace(n2, namespace),
5063
- slotScopeIds
5064
- );
5065
- if (!!(process.env.NODE_ENV !== "production")) {
5066
- traverseStaticChildren(n1, n2);
5067
- }
5068
- } else if (!optimized) {
5069
- patchChildren(
5070
- n1,
5071
- n2,
5072
- el,
5073
- null,
5074
- parentComponent,
5075
- parentSuspense,
5076
- resolveChildrenNamespace(n2, namespace),
5077
- slotScopeIds,
5078
- false
5079
- );
5080
- }
5081
- if (patchFlag > 0) {
5082
- if (patchFlag & 16) {
5083
- patchProps(el, oldProps, newProps, parentComponent, namespace);
5084
- } else {
5085
- if (patchFlag & 2) {
5086
- if (oldProps.class !== newProps.class) {
5087
- hostPatchProp(el, "class", null, newProps.class, namespace);
5088
- }
5089
- }
5090
- if (patchFlag & 4) {
5091
- hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
5361
+ const { type, ref, shapeFlag } = n2;
5362
+ switch (type) {
5363
+ case Text:
5364
+ processText(n1, n2, container, anchor);
5365
+ break;
5366
+ case Comment:
5367
+ processCommentNode(n1, n2, container, anchor);
5368
+ break;
5369
+ case Static:
5370
+ if (n1 == null) {
5371
+ mountStaticNode(n2, container, anchor, namespace);
5372
+ } else if (!!(process.env.NODE_ENV !== "production")) {
5373
+ patchStaticNode(n1, n2, container, namespace);
5092
5374
  }
5093
- if (patchFlag & 8) {
5094
- const propsToUpdate = n2.dynamicProps;
5095
- for (let i = 0; i < propsToUpdate.length; i++) {
5096
- const key = propsToUpdate[i];
5097
- const prev = oldProps[key];
5098
- const next = newProps[key];
5099
- if (next !== prev || key === "value") {
5100
- hostPatchProp(el, key, prev, next, namespace, parentComponent);
5101
- }
5102
- }
5375
+ break;
5376
+ case Fragment:
5377
+ processFragment(
5378
+ n1,
5379
+ n2,
5380
+ container,
5381
+ anchor,
5382
+ parentComponent,
5383
+ parentSuspense,
5384
+ namespace,
5385
+ slotScopeIds,
5386
+ optimized
5387
+ );
5388
+ break;
5389
+ default:
5390
+ if (shapeFlag & 1) {
5391
+ processElement(
5392
+ n1,
5393
+ n2,
5394
+ container,
5395
+ anchor,
5396
+ parentComponent,
5397
+ parentSuspense,
5398
+ namespace,
5399
+ slotScopeIds,
5400
+ optimized
5401
+ );
5402
+ } else if (shapeFlag & 6) {
5403
+ processComponent(
5404
+ n1,
5405
+ n2,
5406
+ container,
5407
+ anchor,
5408
+ parentComponent,
5409
+ parentSuspense,
5410
+ namespace,
5411
+ slotScopeIds,
5412
+ optimized
5413
+ );
5414
+ } else if (shapeFlag & 64) {
5415
+ type.process(
5416
+ n1,
5417
+ n2,
5418
+ container,
5419
+ anchor,
5420
+ parentComponent,
5421
+ parentSuspense,
5422
+ namespace,
5423
+ slotScopeIds,
5424
+ optimized,
5425
+ internals
5426
+ );
5427
+ } else if (shapeFlag & 128) {
5428
+ type.process(
5429
+ n1,
5430
+ n2,
5431
+ container,
5432
+ anchor,
5433
+ parentComponent,
5434
+ parentSuspense,
5435
+ namespace,
5436
+ slotScopeIds,
5437
+ optimized,
5438
+ internals
5439
+ );
5440
+ } else if (!!(process.env.NODE_ENV !== "production")) {
5441
+ warn$1("Invalid VNode type:", type, `(${typeof type})`);
5103
5442
  }
5104
- }
5105
- if (patchFlag & 1) {
5106
- if (n1.children !== n2.children) {
5107
- hostSetElementText(el, n2.children);
5443
+ }
5444
+ if (ref != null && parentComponent) {
5445
+ setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
5446
+ } else if (ref == null && n1 && n1.ref != null) {
5447
+ setRef(n1.ref, null, parentSuspense, n1, true);
5448
+ }
5449
+ };
5450
+ const processText = (n1, n2, container, anchor) => {
5451
+ if (n1 == null) {
5452
+ hostInsert(
5453
+ n2.el = hostCreateText(n2.children),
5454
+ container,
5455
+ anchor
5456
+ );
5457
+ } else {
5458
+ const el = n2.el = n1.el;
5459
+ if (n2.children !== n1.children) {
5460
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) {
5461
+ const childNodes = container.childNodes;
5462
+ const newChild = hostCreateText(n2.children);
5463
+ const oldChild = childNodes[n2.__elIndex = n1.__elIndex];
5464
+ hostInsert(newChild, container, oldChild);
5465
+ hostRemove(oldChild);
5466
+ } else {
5467
+ hostSetText(el, n2.children);
5108
5468
  }
5109
5469
  }
5110
- } else if (!optimized && dynamicChildren == null) {
5111
- patchProps(el, oldProps, newProps, parentComponent, namespace);
5112
5470
  }
5113
- if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
5114
- queuePostRenderEffect(() => {
5115
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5116
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
5117
- }, parentSuspense);
5471
+ };
5472
+ const processCommentNode = (n1, n2, container, anchor) => {
5473
+ if (n1 == null) {
5474
+ hostInsert(
5475
+ n2.el = hostCreateComment(n2.children || ""),
5476
+ container,
5477
+ anchor
5478
+ );
5479
+ } else {
5480
+ n2.el = n1.el;
5118
5481
  }
5119
5482
  };
5120
- const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
5121
- for (let i = 0; i < newChildren.length; i++) {
5122
- const oldVNode = oldChildren[i];
5123
- const newVNode = newChildren[i];
5124
- const container = (
5125
- // oldVNode may be an errored async setup() component inside Suspense
5126
- // which will not have a mounted element
5127
- oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
5128
- // of the Fragment itself so it can move its children.
5129
- (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
5130
- // which also requires the correct parent container
5131
- !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
5132
- oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
5133
- // In other cases, the parent container is not actually used so we
5134
- // just pass the block element here to avoid a DOM parentNode call.
5135
- fallbackContainer
5136
- )
5483
+ const mountStaticNode = (n2, container, anchor, namespace) => {
5484
+ [n2.el, n2.anchor] = hostInsertStaticContent(
5485
+ n2.children,
5486
+ container,
5487
+ anchor,
5488
+ namespace,
5489
+ n2.el,
5490
+ n2.anchor
5491
+ );
5492
+ };
5493
+ const patchStaticNode = (n1, n2, container, namespace) => {
5494
+ if (n2.children !== n1.children) {
5495
+ const anchor = hostNextSibling(n1.anchor);
5496
+ removeStaticNode(n1);
5497
+ [n2.el, n2.anchor] = hostInsertStaticContent(
5498
+ n2.children,
5499
+ container,
5500
+ anchor,
5501
+ namespace
5137
5502
  );
5138
- patch(
5139
- oldVNode,
5140
- newVNode,
5503
+ } else {
5504
+ n2.el = n1.el;
5505
+ n2.anchor = n1.anchor;
5506
+ }
5507
+ };
5508
+ const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
5509
+ let next;
5510
+ while (el && el !== anchor) {
5511
+ next = hostNextSibling(el);
5512
+ hostInsert(el, container, nextSibling);
5513
+ el = next;
5514
+ }
5515
+ hostInsert(anchor, container, nextSibling);
5516
+ };
5517
+ const removeStaticNode = ({ el, anchor }) => {
5518
+ let next;
5519
+ while (el && el !== anchor) {
5520
+ next = hostNextSibling(el);
5521
+ hostRemove(el);
5522
+ el = next;
5523
+ }
5524
+ hostRemove(anchor);
5525
+ };
5526
+ const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5527
+ if (n2.type === "svg") {
5528
+ namespace = "svg";
5529
+ } else if (n2.type === "math") {
5530
+ namespace = "mathml";
5531
+ }
5532
+ if (n1 == null) {
5533
+ mountElement(
5534
+ n2,
5141
5535
  container,
5142
- null,
5536
+ anchor,
5143
5537
  parentComponent,
5144
5538
  parentSuspense,
5145
5539
  namespace,
5146
5540
  slotScopeIds,
5147
- true
5541
+ optimized
5148
5542
  );
5543
+ } else {
5544
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
5545
+ try {
5546
+ if (customElement) {
5547
+ customElement._beginPatch();
5548
+ }
5549
+ patchElement(
5550
+ n1,
5551
+ n2,
5552
+ parentComponent,
5553
+ parentSuspense,
5554
+ namespace,
5555
+ slotScopeIds,
5556
+ optimized
5557
+ );
5558
+ } finally {
5559
+ if (customElement) {
5560
+ customElement._endPatch();
5561
+ }
5562
+ }
5149
5563
  }
5150
5564
  };
5151
- const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
5152
- if (oldProps !== newProps) {
5565
+ const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5566
+ let el;
5567
+ let vnodeHook;
5568
+ const { props, shapeFlag, transition, dirs } = vnode;
5569
+ el = vnode.el = hostCreateElement(
5570
+ vnode.type,
5571
+ namespace,
5572
+ props && props.is,
5573
+ props
5574
+ );
5575
+ if (shapeFlag & 8) {
5576
+ hostSetElementText(el, vnode.children);
5577
+ } else if (shapeFlag & 16) {
5578
+ mountChildren(
5579
+ vnode.children,
5580
+ el,
5581
+ null,
5582
+ parentComponent,
5583
+ parentSuspense,
5584
+ resolveChildrenNamespace(vnode, namespace),
5585
+ slotScopeIds,
5586
+ optimized
5587
+ );
5588
+ }
5589
+ if (dirs) {
5590
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
5591
+ }
5592
+ setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
5593
+ if (props) {
5594
+ for (const key in props) {
5595
+ if (key !== "value" && !isReservedProp(key)) {
5596
+ hostPatchProp(el, key, null, props[key], namespace, parentComponent);
5597
+ }
5598
+ }
5599
+ if ("value" in props) {
5600
+ hostPatchProp(el, "value", null, props.value, namespace);
5601
+ }
5602
+ if (vnodeHook = props.onVnodeBeforeMount) {
5603
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
5604
+ }
5605
+ }
5606
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5607
+ def(el, "__vnode", vnode, true);
5608
+ def(el, "__vueParentComponent", parentComponent, true);
5609
+ }
5610
+ if (dirs) {
5611
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
5612
+ }
5613
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
5614
+ if (needCallTransitionHooks) {
5615
+ transition.beforeEnter(el);
5616
+ }
5617
+ hostInsert(el, container, anchor);
5618
+ if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
5619
+ queuePostRenderEffect(() => {
5620
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5621
+ needCallTransitionHooks && transition.enter(el);
5622
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
5623
+ }, parentSuspense);
5624
+ }
5625
+ };
5626
+ const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
5627
+ if (scopeId) {
5628
+ hostSetScopeId(el, scopeId);
5629
+ }
5630
+ if (slotScopeIds) {
5631
+ for (let i = 0; i < slotScopeIds.length; i++) {
5632
+ hostSetScopeId(el, slotScopeIds[i]);
5633
+ }
5634
+ }
5635
+ if (parentComponent) {
5636
+ let subTree = parentComponent.subTree;
5637
+ if (!!(process.env.NODE_ENV !== "production") && subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
5638
+ subTree = filterSingleRoot(subTree.children) || subTree;
5639
+ }
5640
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
5641
+ const parentVNode = parentComponent.vnode;
5642
+ setScopeId(
5643
+ el,
5644
+ parentVNode,
5645
+ parentVNode.scopeId,
5646
+ parentVNode.slotScopeIds,
5647
+ parentComponent.parent
5648
+ );
5649
+ }
5650
+ }
5651
+ };
5652
+ const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
5653
+ for (let i = start; i < children.length; i++) {
5654
+ const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
5655
+ patch(
5656
+ null,
5657
+ child,
5658
+ container,
5659
+ anchor,
5660
+ parentComponent,
5661
+ parentSuspense,
5662
+ namespace,
5663
+ slotScopeIds,
5664
+ optimized
5665
+ );
5666
+ }
5667
+ };
5668
+ const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5669
+ const el = n2.el = n1.el;
5670
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5671
+ el.__vnode = n2;
5672
+ }
5673
+ let { patchFlag, dynamicChildren, dirs } = n2;
5674
+ patchFlag |= n1.patchFlag & 16;
5675
+ const oldProps = n1.props || EMPTY_OBJ;
5676
+ const newProps = n2.props || EMPTY_OBJ;
5677
+ let vnodeHook;
5678
+ parentComponent && toggleRecurse(parentComponent, false);
5679
+ if (vnodeHook = newProps.onVnodeBeforeUpdate) {
5680
+ invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5681
+ }
5682
+ if (dirs) {
5683
+ invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
5684
+ }
5685
+ parentComponent && toggleRecurse(parentComponent, true);
5686
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
5687
+ patchFlag = 0;
5688
+ optimized = false;
5689
+ dynamicChildren = null;
5690
+ }
5691
+ if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
5692
+ hostSetElementText(el, "");
5693
+ }
5694
+ if (dynamicChildren) {
5695
+ patchBlockChildren(
5696
+ n1.dynamicChildren,
5697
+ dynamicChildren,
5698
+ el,
5699
+ parentComponent,
5700
+ parentSuspense,
5701
+ resolveChildrenNamespace(n2, namespace),
5702
+ slotScopeIds
5703
+ );
5704
+ if (!!(process.env.NODE_ENV !== "production")) {
5705
+ traverseStaticChildren(n1, n2);
5706
+ }
5707
+ } else if (!optimized) {
5708
+ patchChildren(
5709
+ n1,
5710
+ n2,
5711
+ el,
5712
+ null,
5713
+ parentComponent,
5714
+ parentSuspense,
5715
+ resolveChildrenNamespace(n2, namespace),
5716
+ slotScopeIds,
5717
+ false
5718
+ );
5719
+ }
5720
+ if (patchFlag > 0) {
5721
+ if (patchFlag & 16) {
5722
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
5723
+ } else {
5724
+ if (patchFlag & 2) {
5725
+ if (oldProps.class !== newProps.class) {
5726
+ hostPatchProp(el, "class", null, newProps.class, namespace);
5727
+ }
5728
+ }
5729
+ if (patchFlag & 4) {
5730
+ hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
5731
+ }
5732
+ if (patchFlag & 8) {
5733
+ const propsToUpdate = n2.dynamicProps;
5734
+ for (let i = 0; i < propsToUpdate.length; i++) {
5735
+ const key = propsToUpdate[i];
5736
+ const prev = oldProps[key];
5737
+ const next = newProps[key];
5738
+ if (next !== prev || key === "value") {
5739
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
5740
+ }
5741
+ }
5742
+ }
5743
+ }
5744
+ if (patchFlag & 1) {
5745
+ if (n1.children !== n2.children) {
5746
+ hostSetElementText(el, n2.children);
5747
+ }
5748
+ }
5749
+ } else if (!optimized && dynamicChildren == null) {
5750
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
5751
+ }
5752
+ if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
5753
+ queuePostRenderEffect(() => {
5754
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5755
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
5756
+ }, parentSuspense);
5757
+ }
5758
+ };
5759
+ const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
5760
+ for (let i = 0; i < newChildren.length; i++) {
5761
+ const oldVNode = oldChildren[i];
5762
+ const newVNode = newChildren[i];
5763
+ const container = (
5764
+ // oldVNode may be an errored async setup() component inside Suspense
5765
+ // which will not have a mounted element
5766
+ oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
5767
+ // of the Fragment itself so it can move its children.
5768
+ (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
5769
+ // which also requires the correct parent container
5770
+ !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
5771
+ oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
5772
+ // In other cases, the parent container is not actually used so we
5773
+ // just pass the block element here to avoid a DOM parentNode call.
5774
+ fallbackContainer
5775
+ )
5776
+ );
5777
+ patch(
5778
+ oldVNode,
5779
+ newVNode,
5780
+ container,
5781
+ null,
5782
+ parentComponent,
5783
+ parentSuspense,
5784
+ namespace,
5785
+ slotScopeIds,
5786
+ true
5787
+ );
5788
+ }
5789
+ };
5790
+ const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
5791
+ if (oldProps !== newProps) {
5153
5792
  if (oldProps !== EMPTY_OBJ) {
5154
5793
  for (const key in oldProps) {
5155
5794
  if (!isReservedProp(key) && !(key in newProps)) {
@@ -5210,7 +5849,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5210
5849
  } else {
5211
5850
  if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
5212
5851
  // of renderSlot() with no valid children
5213
- n1.dynamicChildren) {
5852
+ n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
5214
5853
  patchBlockChildren(
5215
5854
  n1.dynamicChildren,
5216
5855
  dynamicChildren,
@@ -5495,1360 +6134,743 @@ function baseCreateRenderer(options, createHydrationFns) {
5495
6134
  // parent may have changed if it's in a teleport
5496
6135
  hostParentNode(prevTree.el),
5497
6136
  // anchor may have changed if it's in a fragment
5498
- getNextHostNode(prevTree),
5499
- instance,
5500
- parentSuspense,
5501
- namespace
5502
- );
5503
- if (!!(process.env.NODE_ENV !== "production")) {
5504
- endMeasure(instance, `patch`);
5505
- }
5506
- next.el = nextTree.el;
5507
- if (originNext === null) {
5508
- updateHOCHostEl(instance, nextTree.el);
5509
- }
5510
- if (u) {
5511
- queuePostRenderEffect(u, parentSuspense);
5512
- }
5513
- if (vnodeHook = next.props && next.props.onVnodeUpdated) {
5514
- queuePostRenderEffect(
5515
- () => invokeVNodeHook(vnodeHook, parent, next, vnode),
5516
- parentSuspense
5517
- );
5518
- }
5519
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5520
- devtoolsComponentUpdated(instance);
5521
- }
5522
- if (!!(process.env.NODE_ENV !== "production")) {
5523
- popWarningContext();
5524
- }
5525
- }
5526
- };
5527
- instance.scope.on();
5528
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
5529
- instance.scope.off();
5530
- const update = instance.update = effect.run.bind(effect);
5531
- const job = instance.job = effect.runIfDirty.bind(effect);
5532
- job.i = instance;
5533
- job.id = instance.uid;
5534
- effect.scheduler = () => queueJob(job);
5535
- toggleRecurse(instance, true);
5536
- if (!!(process.env.NODE_ENV !== "production")) {
5537
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5538
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5539
- }
5540
- update();
5541
- };
5542
- const updateComponentPreRender = (instance, nextVNode, optimized) => {
5543
- nextVNode.component = instance;
5544
- const prevProps = instance.vnode.props;
5545
- instance.vnode = nextVNode;
5546
- instance.next = null;
5547
- updateProps(instance, nextVNode.props, prevProps, optimized);
5548
- updateSlots(instance, nextVNode.children, optimized);
5549
- pauseTracking();
5550
- flushPreFlushCbs(instance);
5551
- resetTracking();
5552
- };
5553
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5554
- const c1 = n1 && n1.children;
5555
- const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5556
- const c2 = n2.children;
5557
- const { patchFlag, shapeFlag } = n2;
5558
- if (patchFlag > 0) {
5559
- if (patchFlag & 128) {
5560
- patchKeyedChildren(
5561
- c1,
5562
- c2,
5563
- container,
5564
- anchor,
5565
- parentComponent,
5566
- parentSuspense,
5567
- namespace,
5568
- slotScopeIds,
5569
- optimized
5570
- );
5571
- return;
5572
- } else if (patchFlag & 256) {
5573
- patchUnkeyedChildren(
5574
- c1,
5575
- c2,
5576
- container,
5577
- anchor,
5578
- parentComponent,
5579
- parentSuspense,
5580
- namespace,
5581
- slotScopeIds,
5582
- optimized
5583
- );
5584
- return;
5585
- }
5586
- }
5587
- if (shapeFlag & 8) {
5588
- if (prevShapeFlag & 16) {
5589
- unmountChildren(c1, parentComponent, parentSuspense);
5590
- }
5591
- if (c2 !== c1) {
5592
- hostSetElementText(container, c2);
5593
- }
5594
- } else {
5595
- if (prevShapeFlag & 16) {
5596
- if (shapeFlag & 16) {
5597
- patchKeyedChildren(
5598
- c1,
5599
- c2,
5600
- container,
5601
- anchor,
5602
- parentComponent,
5603
- parentSuspense,
5604
- namespace,
5605
- slotScopeIds,
5606
- optimized
5607
- );
5608
- } else {
5609
- unmountChildren(c1, parentComponent, parentSuspense, true);
5610
- }
5611
- } else {
5612
- if (prevShapeFlag & 8) {
5613
- hostSetElementText(container, "");
5614
- }
5615
- if (shapeFlag & 16) {
5616
- mountChildren(
5617
- c2,
5618
- container,
5619
- anchor,
5620
- parentComponent,
5621
- parentSuspense,
5622
- namespace,
5623
- slotScopeIds,
5624
- optimized
5625
- );
5626
- }
5627
- }
5628
- }
5629
- };
5630
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5631
- c1 = c1 || EMPTY_ARR;
5632
- c2 = c2 || EMPTY_ARR;
5633
- const oldLength = c1.length;
5634
- const newLength = c2.length;
5635
- const commonLength = Math.min(oldLength, newLength);
5636
- let i;
5637
- for (i = 0; i < commonLength; i++) {
5638
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5639
- patch(
5640
- c1[i],
5641
- nextChild,
5642
- container,
5643
- null,
5644
- parentComponent,
5645
- parentSuspense,
5646
- namespace,
5647
- slotScopeIds,
5648
- optimized
5649
- );
5650
- }
5651
- if (oldLength > newLength) {
5652
- unmountChildren(
5653
- c1,
5654
- parentComponent,
5655
- parentSuspense,
5656
- true,
5657
- false,
5658
- commonLength
5659
- );
5660
- } else {
5661
- mountChildren(
5662
- c2,
5663
- container,
5664
- anchor,
5665
- parentComponent,
5666
- parentSuspense,
5667
- namespace,
5668
- slotScopeIds,
5669
- optimized,
5670
- commonLength
5671
- );
5672
- }
5673
- };
5674
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5675
- let i = 0;
5676
- const l2 = c2.length;
5677
- let e1 = c1.length - 1;
5678
- let e2 = l2 - 1;
5679
- while (i <= e1 && i <= e2) {
5680
- const n1 = c1[i];
5681
- const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5682
- if (isSameVNodeType(n1, n2)) {
5683
- patch(
5684
- n1,
5685
- n2,
5686
- container,
5687
- null,
5688
- parentComponent,
5689
- parentSuspense,
5690
- namespace,
5691
- slotScopeIds,
5692
- optimized
5693
- );
5694
- } else {
5695
- break;
5696
- }
5697
- i++;
5698
- }
5699
- while (i <= e1 && i <= e2) {
5700
- const n1 = c1[e1];
5701
- const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
5702
- if (isSameVNodeType(n1, n2)) {
5703
- patch(
5704
- n1,
5705
- n2,
5706
- container,
5707
- null,
5708
- parentComponent,
5709
- parentSuspense,
5710
- namespace,
5711
- slotScopeIds,
5712
- optimized
5713
- );
5714
- } else {
5715
- break;
5716
- }
5717
- e1--;
5718
- e2--;
5719
- }
5720
- if (i > e1) {
5721
- if (i <= e2) {
5722
- const nextPos = e2 + 1;
5723
- const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
5724
- while (i <= e2) {
5725
- patch(
5726
- null,
5727
- c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
5728
- container,
5729
- anchor,
5730
- parentComponent,
5731
- parentSuspense,
5732
- namespace,
5733
- slotScopeIds,
5734
- optimized
5735
- );
5736
- i++;
5737
- }
5738
- }
5739
- } else if (i > e2) {
5740
- while (i <= e1) {
5741
- unmount(c1[i], parentComponent, parentSuspense, true);
5742
- i++;
5743
- }
5744
- } else {
5745
- const s1 = i;
5746
- const s2 = i;
5747
- const keyToNewIndexMap = /* @__PURE__ */ new Map();
5748
- for (i = s2; i <= e2; i++) {
5749
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
5750
- if (nextChild.key != null) {
5751
- if (!!(process.env.NODE_ENV !== "production") && keyToNewIndexMap.has(nextChild.key)) {
5752
- warn$1(
5753
- `Duplicate keys found during update:`,
5754
- JSON.stringify(nextChild.key),
5755
- `Make sure keys are unique.`
5756
- );
5757
- }
5758
- keyToNewIndexMap.set(nextChild.key, i);
5759
- }
5760
- }
5761
- let j;
5762
- let patched = 0;
5763
- const toBePatched = e2 - s2 + 1;
5764
- let moved = false;
5765
- let maxNewIndexSoFar = 0;
5766
- const newIndexToOldIndexMap = new Array(toBePatched);
5767
- for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
5768
- for (i = s1; i <= e1; i++) {
5769
- const prevChild = c1[i];
5770
- if (patched >= toBePatched) {
5771
- unmount(prevChild, parentComponent, parentSuspense, true);
5772
- continue;
5773
- }
5774
- let newIndex;
5775
- if (prevChild.key != null) {
5776
- newIndex = keyToNewIndexMap.get(prevChild.key);
5777
- } else {
5778
- for (j = s2; j <= e2; j++) {
5779
- if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
5780
- newIndex = j;
5781
- break;
5782
- }
5783
- }
5784
- }
5785
- if (newIndex === void 0) {
5786
- unmount(prevChild, parentComponent, parentSuspense, true);
5787
- } else {
5788
- newIndexToOldIndexMap[newIndex - s2] = i + 1;
5789
- if (newIndex >= maxNewIndexSoFar) {
5790
- maxNewIndexSoFar = newIndex;
5791
- } else {
5792
- moved = true;
5793
- }
5794
- patch(
5795
- prevChild,
5796
- c2[newIndex],
5797
- container,
5798
- null,
5799
- parentComponent,
5800
- parentSuspense,
5801
- namespace,
5802
- slotScopeIds,
5803
- optimized
5804
- );
5805
- patched++;
5806
- }
5807
- }
5808
- const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
5809
- j = increasingNewIndexSequence.length - 1;
5810
- for (i = toBePatched - 1; i >= 0; i--) {
5811
- const nextIndex = s2 + i;
5812
- const nextChild = c2[nextIndex];
5813
- const anchorVNode = c2[nextIndex + 1];
5814
- const anchor = nextIndex + 1 < l2 ? (
5815
- // #13559, fallback to el placeholder for unresolved async component
5816
- anchorVNode.el || anchorVNode.placeholder
5817
- ) : parentAnchor;
5818
- if (newIndexToOldIndexMap[i] === 0) {
5819
- patch(
5820
- null,
5821
- nextChild,
5822
- container,
5823
- anchor,
5824
- parentComponent,
5825
- parentSuspense,
5826
- namespace,
5827
- slotScopeIds,
5828
- optimized
5829
- );
5830
- } else if (moved) {
5831
- if (j < 0 || i !== increasingNewIndexSequence[j]) {
5832
- move(nextChild, container, anchor, 2);
5833
- } else {
5834
- j--;
5835
- }
5836
- }
5837
- }
5838
- }
5839
- };
5840
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5841
- const { el, type, transition, children, shapeFlag } = vnode;
5842
- if (shapeFlag & 6) {
5843
- move(vnode.component.subTree, container, anchor, moveType);
5844
- return;
5845
- }
5846
- if (shapeFlag & 128) {
5847
- vnode.suspense.move(container, anchor, moveType);
5848
- return;
5849
- }
5850
- if (shapeFlag & 64) {
5851
- type.move(vnode, container, anchor, internals);
5852
- return;
5853
- }
5854
- if (type === Fragment) {
5855
- hostInsert(el, container, anchor);
5856
- for (let i = 0; i < children.length; i++) {
5857
- move(children[i], container, anchor, moveType);
5858
- }
5859
- hostInsert(vnode.anchor, container, anchor);
5860
- return;
5861
- }
5862
- if (type === Static) {
5863
- moveStaticNode(vnode, container, anchor);
5864
- return;
5865
- }
5866
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5867
- if (needTransition2) {
5868
- if (moveType === 0) {
5869
- transition.beforeEnter(el);
5870
- hostInsert(el, container, anchor);
5871
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5872
- } else {
5873
- const { leave, delayLeave, afterLeave } = transition;
5874
- const remove2 = () => {
5875
- if (vnode.ctx.isUnmounted) {
5876
- hostRemove(el);
5877
- } else {
5878
- hostInsert(el, container, anchor);
5879
- }
5880
- };
5881
- const performLeave = () => {
5882
- if (el._isLeaving) {
5883
- el[leaveCbKey](
5884
- true
5885
- /* cancelled */
5886
- );
5887
- }
5888
- leave(el, () => {
5889
- remove2();
5890
- afterLeave && afterLeave();
5891
- });
5892
- };
5893
- if (delayLeave) {
5894
- delayLeave(el, remove2, performLeave);
5895
- } else {
5896
- performLeave();
5897
- }
5898
- }
5899
- } else {
5900
- hostInsert(el, container, anchor);
5901
- }
5902
- };
5903
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5904
- const {
5905
- type,
5906
- props,
5907
- ref,
5908
- children,
5909
- dynamicChildren,
5910
- shapeFlag,
5911
- patchFlag,
5912
- dirs,
5913
- cacheIndex
5914
- } = vnode;
5915
- if (patchFlag === -2) {
5916
- optimized = false;
5917
- }
5918
- if (ref != null) {
5919
- pauseTracking();
5920
- setRef(ref, null, parentSuspense, vnode, true);
5921
- resetTracking();
5922
- }
5923
- if (cacheIndex != null) {
5924
- parentComponent.renderCache[cacheIndex] = void 0;
5925
- }
5926
- if (shapeFlag & 256) {
5927
- parentComponent.ctx.deactivate(vnode);
5928
- return;
5929
- }
5930
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
5931
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
5932
- let vnodeHook;
5933
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
5934
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
5935
- }
5936
- if (shapeFlag & 6) {
5937
- unmountComponent(vnode.component, parentSuspense, doRemove);
5938
- } else {
5939
- if (shapeFlag & 128) {
5940
- vnode.suspense.unmount(parentSuspense, doRemove);
5941
- return;
5942
- }
5943
- if (shouldInvokeDirs) {
5944
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
5945
- }
5946
- if (shapeFlag & 64) {
5947
- vnode.type.remove(
5948
- vnode,
5949
- parentComponent,
5950
- parentSuspense,
5951
- internals,
5952
- doRemove
5953
- );
5954
- } else if (dynamicChildren && // #5154
5955
- // when v-once is used inside a block, setBlockTracking(-1) marks the
5956
- // parent block with hasOnce: true
5957
- // so that it doesn't take the fast path during unmount - otherwise
5958
- // components nested in v-once are never unmounted.
5959
- !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
5960
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5961
- unmountChildren(
5962
- dynamicChildren,
5963
- parentComponent,
5964
- parentSuspense,
5965
- false,
5966
- true
5967
- );
5968
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5969
- unmountChildren(children, parentComponent, parentSuspense);
5970
- }
5971
- if (doRemove) {
5972
- remove(vnode);
5973
- }
5974
- }
5975
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5976
- queuePostRenderEffect(() => {
5977
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5978
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5979
- }, parentSuspense);
5980
- }
5981
- };
5982
- const remove = (vnode) => {
5983
- const { type, el, anchor, transition } = vnode;
5984
- if (type === Fragment) {
5985
- if (!!(process.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
5986
- vnode.children.forEach((child) => {
5987
- if (child.type === Comment) {
5988
- hostRemove(child.el);
5989
- } else {
5990
- remove(child);
5991
- }
5992
- });
5993
- } else {
5994
- removeFragment(el, anchor);
5995
- }
5996
- return;
5997
- }
5998
- if (type === Static) {
5999
- removeStaticNode(vnode);
6000
- return;
6001
- }
6002
- const performRemove = () => {
6003
- hostRemove(el);
6004
- if (transition && !transition.persisted && transition.afterLeave) {
6005
- transition.afterLeave();
6006
- }
6007
- };
6008
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6009
- const { leave, delayLeave } = transition;
6010
- const performLeave = () => leave(el, performRemove);
6011
- if (delayLeave) {
6012
- delayLeave(vnode.el, performRemove, performLeave);
6013
- } else {
6014
- performLeave();
6015
- }
6016
- } else {
6017
- performRemove();
6018
- }
6019
- };
6020
- const removeFragment = (cur, end) => {
6021
- let next;
6022
- while (cur !== end) {
6023
- next = hostNextSibling(cur);
6024
- hostRemove(cur);
6025
- cur = next;
6026
- }
6027
- hostRemove(end);
6028
- };
6029
- const unmountComponent = (instance, parentSuspense, doRemove) => {
6030
- if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
6031
- unregisterHMR(instance);
6032
- }
6033
- const { bum, scope, job, subTree, um, m, a } = instance;
6034
- invalidateMount(m);
6035
- invalidateMount(a);
6036
- if (bum) {
6037
- invokeArrayFns(bum);
6038
- }
6039
- scope.stop();
6040
- if (job) {
6041
- job.flags |= 8;
6042
- unmount(subTree, instance, parentSuspense, doRemove);
6043
- }
6044
- if (um) {
6045
- queuePostRenderEffect(um, parentSuspense);
6046
- }
6047
- queuePostRenderEffect(() => {
6048
- instance.isUnmounted = true;
6049
- }, parentSuspense);
6050
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6051
- devtoolsComponentRemoved(instance);
6052
- }
6053
- };
6054
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
6055
- for (let i = start; i < children.length; i++) {
6056
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
6057
- }
6058
- };
6059
- const getNextHostNode = (vnode) => {
6060
- if (vnode.shapeFlag & 6) {
6061
- return getNextHostNode(vnode.component.subTree);
6062
- }
6063
- if (vnode.shapeFlag & 128) {
6064
- return vnode.suspense.next();
6065
- }
6066
- const el = hostNextSibling(vnode.anchor || vnode.el);
6067
- const teleportEnd = el && el[TeleportEndKey];
6068
- return teleportEnd ? hostNextSibling(teleportEnd) : el;
6069
- };
6070
- let isFlushing = false;
6071
- const render = (vnode, container, namespace) => {
6072
- if (vnode == null) {
6073
- if (container._vnode) {
6074
- unmount(container._vnode, null, null, true);
6075
- }
6076
- } else {
6077
- patch(
6078
- container._vnode || null,
6079
- vnode,
6080
- container,
6081
- null,
6082
- null,
6083
- null,
6084
- namespace
6085
- );
6086
- }
6087
- container._vnode = vnode;
6088
- if (!isFlushing) {
6089
- isFlushing = true;
6090
- flushPreFlushCbs();
6091
- flushPostFlushCbs();
6092
- isFlushing = false;
6093
- }
6094
- };
6095
- const internals = {
6096
- p: patch,
6097
- um: unmount,
6098
- m: move,
6099
- r: remove,
6100
- mt: mountComponent,
6101
- mc: mountChildren,
6102
- pc: patchChildren,
6103
- pbc: patchBlockChildren,
6104
- n: getNextHostNode,
6105
- o: options
6106
- };
6107
- let hydrate;
6108
- let hydrateNode;
6109
- if (createHydrationFns) {
6110
- [hydrate, hydrateNode] = createHydrationFns(
6111
- internals
6112
- );
6113
- }
6114
- return {
6115
- render,
6116
- hydrate,
6117
- createApp: createAppAPI(render, hydrate)
6118
- };
6119
- }
6120
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
6121
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6122
- }
6123
- function toggleRecurse({ effect, job }, allowed) {
6124
- if (allowed) {
6125
- effect.flags |= 32;
6126
- job.flags |= 4;
6127
- } else {
6128
- effect.flags &= -33;
6129
- job.flags &= -5;
6130
- }
6131
- }
6132
- function needTransition(parentSuspense, transition) {
6133
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6134
- }
6135
- function traverseStaticChildren(n1, n2, shallow = false) {
6136
- const ch1 = n1.children;
6137
- const ch2 = n2.children;
6138
- if (isArray(ch1) && isArray(ch2)) {
6139
- for (let i = 0; i < ch1.length; i++) {
6140
- const c1 = ch1[i];
6141
- let c2 = ch2[i];
6142
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
6143
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
6144
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
6145
- c2.el = c1.el;
6137
+ getNextHostNode(prevTree),
6138
+ instance,
6139
+ parentSuspense,
6140
+ namespace
6141
+ );
6142
+ if (!!(process.env.NODE_ENV !== "production")) {
6143
+ endMeasure(instance, `patch`);
6144
+ }
6145
+ next.el = nextTree.el;
6146
+ if (originNext === null) {
6147
+ updateHOCHostEl(instance, nextTree.el);
6148
+ }
6149
+ if (u) {
6150
+ queuePostRenderEffect(u, parentSuspense);
6151
+ }
6152
+ if (vnodeHook = next.props && next.props.onVnodeUpdated) {
6153
+ queuePostRenderEffect(
6154
+ () => invokeVNodeHook(vnodeHook, parent, next, vnode),
6155
+ parentSuspense
6156
+ );
6157
+ }
6158
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6159
+ devtoolsComponentUpdated(instance);
6160
+ }
6161
+ if (!!(process.env.NODE_ENV !== "production")) {
6162
+ popWarningContext();
6146
6163
  }
6147
- if (!shallow && c2.patchFlag !== -2)
6148
- traverseStaticChildren(c1, c2);
6149
- }
6150
- if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
6151
- c2.patchFlag !== -1) {
6152
- c2.el = c1.el;
6153
- }
6154
- if (c2.type === Comment && !c2.el) {
6155
- c2.el = c1.el;
6156
6164
  }
6157
- if (!!(process.env.NODE_ENV !== "production")) {
6158
- c2.el && (c2.el.__vnode = c2);
6165
+ };
6166
+ instance.scope.on();
6167
+ const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
6168
+ instance.scope.off();
6169
+ const update = instance.update = effect.run.bind(effect);
6170
+ const job = instance.job = effect.runIfDirty.bind(effect);
6171
+ job.i = instance;
6172
+ job.id = instance.uid;
6173
+ effect.scheduler = () => queueJob(job);
6174
+ toggleRecurse(instance, true);
6175
+ if (!!(process.env.NODE_ENV !== "production")) {
6176
+ effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
6177
+ effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
6178
+ }
6179
+ update();
6180
+ };
6181
+ const updateComponentPreRender = (instance, nextVNode, optimized) => {
6182
+ nextVNode.component = instance;
6183
+ const prevProps = instance.vnode.props;
6184
+ instance.vnode = nextVNode;
6185
+ instance.next = null;
6186
+ updateProps(instance, nextVNode.props, prevProps, optimized);
6187
+ updateSlots(instance, nextVNode.children, optimized);
6188
+ pauseTracking();
6189
+ flushPreFlushCbs(instance);
6190
+ resetTracking();
6191
+ };
6192
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
6193
+ const c1 = n1 && n1.children;
6194
+ const prevShapeFlag = n1 ? n1.shapeFlag : 0;
6195
+ const c2 = n2.children;
6196
+ const { patchFlag, shapeFlag } = n2;
6197
+ if (patchFlag > 0) {
6198
+ if (patchFlag & 128) {
6199
+ patchKeyedChildren(
6200
+ c1,
6201
+ c2,
6202
+ container,
6203
+ anchor,
6204
+ parentComponent,
6205
+ parentSuspense,
6206
+ namespace,
6207
+ slotScopeIds,
6208
+ optimized
6209
+ );
6210
+ return;
6211
+ } else if (patchFlag & 256) {
6212
+ patchUnkeyedChildren(
6213
+ c1,
6214
+ c2,
6215
+ container,
6216
+ anchor,
6217
+ parentComponent,
6218
+ parentSuspense,
6219
+ namespace,
6220
+ slotScopeIds,
6221
+ optimized
6222
+ );
6223
+ return;
6159
6224
  }
6160
6225
  }
6161
- }
6162
- }
6163
- function getSequence(arr) {
6164
- const p = arr.slice();
6165
- const result = [0];
6166
- let i, j, u, v, c;
6167
- const len = arr.length;
6168
- for (i = 0; i < len; i++) {
6169
- const arrI = arr[i];
6170
- if (arrI !== 0) {
6171
- j = result[result.length - 1];
6172
- if (arr[j] < arrI) {
6173
- p[i] = j;
6174
- result.push(i);
6175
- continue;
6226
+ if (shapeFlag & 8) {
6227
+ if (prevShapeFlag & 16) {
6228
+ unmountChildren(c1, parentComponent, parentSuspense);
6176
6229
  }
6177
- u = 0;
6178
- v = result.length - 1;
6179
- while (u < v) {
6180
- c = u + v >> 1;
6181
- if (arr[result[c]] < arrI) {
6182
- u = c + 1;
6230
+ if (c2 !== c1) {
6231
+ hostSetElementText(container, c2);
6232
+ }
6233
+ } else {
6234
+ if (prevShapeFlag & 16) {
6235
+ if (shapeFlag & 16) {
6236
+ patchKeyedChildren(
6237
+ c1,
6238
+ c2,
6239
+ container,
6240
+ anchor,
6241
+ parentComponent,
6242
+ parentSuspense,
6243
+ namespace,
6244
+ slotScopeIds,
6245
+ optimized
6246
+ );
6183
6247
  } else {
6184
- v = c;
6248
+ unmountChildren(c1, parentComponent, parentSuspense, true);
6185
6249
  }
6186
- }
6187
- if (arrI < arr[result[u]]) {
6188
- if (u > 0) {
6189
- p[i] = result[u - 1];
6250
+ } else {
6251
+ if (prevShapeFlag & 8) {
6252
+ hostSetElementText(container, "");
6253
+ }
6254
+ if (shapeFlag & 16) {
6255
+ mountChildren(
6256
+ c2,
6257
+ container,
6258
+ anchor,
6259
+ parentComponent,
6260
+ parentSuspense,
6261
+ namespace,
6262
+ slotScopeIds,
6263
+ optimized
6264
+ );
6190
6265
  }
6191
- result[u] = i;
6192
6266
  }
6193
6267
  }
6194
- }
6195
- u = result.length;
6196
- v = result[u - 1];
6197
- while (u-- > 0) {
6198
- result[u] = v;
6199
- v = p[v];
6200
- }
6201
- return result;
6202
- }
6203
- function locateNonHydratedAsyncRoot(instance) {
6204
- const subComponent = instance.subTree.component;
6205
- if (subComponent) {
6206
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
6207
- return subComponent;
6208
- } else {
6209
- return locateNonHydratedAsyncRoot(subComponent);
6210
- }
6211
- }
6212
- }
6213
- function invalidateMount(hooks) {
6214
- if (hooks) {
6215
- for (let i = 0; i < hooks.length; i++)
6216
- hooks[i].flags |= 8;
6217
- }
6218
- }
6219
-
6220
- const ssrContextKey = Symbol.for("v-scx");
6221
- const useSSRContext = () => {
6222
- {
6223
- const ctx = inject(ssrContextKey);
6224
- if (!ctx) {
6225
- !!(process.env.NODE_ENV !== "production") && warn$1(
6226
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
6227
- );
6228
- }
6229
- return ctx;
6230
- }
6231
- };
6232
-
6233
- function watchEffect(effect, options) {
6234
- return doWatch(effect, null, options);
6235
- }
6236
- function watchPostEffect(effect, options) {
6237
- return doWatch(
6238
- effect,
6239
- null,
6240
- !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "post" }) : { flush: "post" }
6241
- );
6242
- }
6243
- function watchSyncEffect(effect, options) {
6244
- return doWatch(
6245
- effect,
6246
- null,
6247
- !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
6248
- );
6249
- }
6250
- function watch(source, cb, options) {
6251
- if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
6252
- warn$1(
6253
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
6254
- );
6255
- }
6256
- return doWatch(source, cb, options);
6257
- }
6258
- function doWatch(source, cb, options = EMPTY_OBJ) {
6259
- const { immediate, deep, flush, once } = options;
6260
- if (!!(process.env.NODE_ENV !== "production") && !cb) {
6261
- if (immediate !== void 0) {
6262
- warn$1(
6263
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
6268
+ };
6269
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6270
+ c1 = c1 || EMPTY_ARR;
6271
+ c2 = c2 || EMPTY_ARR;
6272
+ const oldLength = c1.length;
6273
+ const newLength = c2.length;
6274
+ const commonLength = Math.min(oldLength, newLength);
6275
+ let i;
6276
+ for (i = 0; i < commonLength; i++) {
6277
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6278
+ patch(
6279
+ c1[i],
6280
+ nextChild,
6281
+ container,
6282
+ null,
6283
+ parentComponent,
6284
+ parentSuspense,
6285
+ namespace,
6286
+ slotScopeIds,
6287
+ optimized
6264
6288
  );
6265
6289
  }
6266
- if (deep !== void 0) {
6267
- warn$1(
6268
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
6290
+ if (oldLength > newLength) {
6291
+ unmountChildren(
6292
+ c1,
6293
+ parentComponent,
6294
+ parentSuspense,
6295
+ true,
6296
+ false,
6297
+ commonLength
6269
6298
  );
6270
- }
6271
- if (once !== void 0) {
6272
- warn$1(
6273
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
6299
+ } else {
6300
+ mountChildren(
6301
+ c2,
6302
+ container,
6303
+ anchor,
6304
+ parentComponent,
6305
+ parentSuspense,
6306
+ namespace,
6307
+ slotScopeIds,
6308
+ optimized,
6309
+ commonLength
6274
6310
  );
6275
6311
  }
6276
- }
6277
- const baseWatchOptions = extend({}, options);
6278
- if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
6279
- const runsImmediately = cb && immediate || !cb && flush !== "post";
6280
- let ssrCleanup;
6281
- if (isInSSRComponentSetup) {
6282
- if (flush === "sync") {
6283
- const ctx = useSSRContext();
6284
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
6285
- } else if (!runsImmediately) {
6286
- const watchStopHandle = () => {
6287
- };
6288
- watchStopHandle.stop = NOOP;
6289
- watchStopHandle.resume = NOOP;
6290
- watchStopHandle.pause = NOOP;
6291
- return watchStopHandle;
6292
- }
6293
- }
6294
- const instance = currentInstance;
6295
- baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
6296
- let isPre = false;
6297
- if (flush === "post") {
6298
- baseWatchOptions.scheduler = (job) => {
6299
- queuePostRenderEffect(job, instance && instance.suspense);
6300
- };
6301
- } else if (flush !== "sync") {
6302
- isPre = true;
6303
- baseWatchOptions.scheduler = (job, isFirstRun) => {
6304
- if (isFirstRun) {
6305
- job();
6312
+ };
6313
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6314
+ let i = 0;
6315
+ const l2 = c2.length;
6316
+ let e1 = c1.length - 1;
6317
+ let e2 = l2 - 1;
6318
+ while (i <= e1 && i <= e2) {
6319
+ const n1 = c1[i];
6320
+ const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6321
+ if (isSameVNodeType(n1, n2)) {
6322
+ patch(
6323
+ n1,
6324
+ n2,
6325
+ container,
6326
+ null,
6327
+ parentComponent,
6328
+ parentSuspense,
6329
+ namespace,
6330
+ slotScopeIds,
6331
+ optimized
6332
+ );
6306
6333
  } else {
6307
- queueJob(job);
6334
+ break;
6308
6335
  }
6309
- };
6310
- }
6311
- baseWatchOptions.augmentJob = (job) => {
6312
- if (cb) {
6313
- job.flags |= 4;
6336
+ i++;
6314
6337
  }
6315
- if (isPre) {
6316
- job.flags |= 2;
6317
- if (instance) {
6318
- job.id = instance.uid;
6319
- job.i = instance;
6338
+ while (i <= e1 && i <= e2) {
6339
+ const n1 = c1[e1];
6340
+ const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
6341
+ if (isSameVNodeType(n1, n2)) {
6342
+ patch(
6343
+ n1,
6344
+ n2,
6345
+ container,
6346
+ null,
6347
+ parentComponent,
6348
+ parentSuspense,
6349
+ namespace,
6350
+ slotScopeIds,
6351
+ optimized
6352
+ );
6353
+ } else {
6354
+ break;
6320
6355
  }
6356
+ e1--;
6357
+ e2--;
6321
6358
  }
6322
- };
6323
- const watchHandle = watch$1(source, cb, baseWatchOptions);
6324
- if (isInSSRComponentSetup) {
6325
- if (ssrCleanup) {
6326
- ssrCleanup.push(watchHandle);
6327
- } else if (runsImmediately) {
6328
- watchHandle();
6329
- }
6330
- }
6331
- return watchHandle;
6332
- }
6333
- function instanceWatch(source, value, options) {
6334
- const publicThis = this.proxy;
6335
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
6336
- let cb;
6337
- if (isFunction(value)) {
6338
- cb = value;
6339
- } else {
6340
- cb = value.handler;
6341
- options = value;
6342
- }
6343
- const reset = setCurrentInstance(this);
6344
- const res = doWatch(getter, cb.bind(publicThis), options);
6345
- reset();
6346
- return res;
6347
- }
6348
- function createPathGetter(ctx, path) {
6349
- const segments = path.split(".");
6350
- return () => {
6351
- let cur = ctx;
6352
- for (let i = 0; i < segments.length && cur; i++) {
6353
- cur = cur[segments[i]];
6354
- }
6355
- return cur;
6356
- };
6357
- }
6358
-
6359
- function useModel(props, name, options = EMPTY_OBJ) {
6360
- const i = getCurrentInstance();
6361
- if (!!(process.env.NODE_ENV !== "production") && !i) {
6362
- warn$1(`useModel() called without active instance.`);
6363
- return ref();
6364
- }
6365
- const camelizedName = camelize(name);
6366
- if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][camelizedName]) {
6367
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
6368
- return ref();
6369
- }
6370
- const hyphenatedName = hyphenate(name);
6371
- const modifiers = getModelModifiers(props, camelizedName);
6372
- const res = customRef((track, trigger) => {
6373
- let localValue;
6374
- let prevSetValue = EMPTY_OBJ;
6375
- let prevEmittedValue;
6376
- watchSyncEffect(() => {
6377
- const propValue = props[camelizedName];
6378
- if (hasChanged(localValue, propValue)) {
6379
- localValue = propValue;
6380
- trigger();
6359
+ if (i > e1) {
6360
+ if (i <= e2) {
6361
+ const nextPos = e2 + 1;
6362
+ const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
6363
+ while (i <= e2) {
6364
+ patch(
6365
+ null,
6366
+ c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
6367
+ container,
6368
+ anchor,
6369
+ parentComponent,
6370
+ parentSuspense,
6371
+ namespace,
6372
+ slotScopeIds,
6373
+ optimized
6374
+ );
6375
+ i++;
6376
+ }
6381
6377
  }
6382
- });
6383
- return {
6384
- get() {
6385
- track();
6386
- return options.get ? options.get(localValue) : localValue;
6387
- },
6388
- set(value) {
6389
- const emittedValue = options.set ? options.set(value) : value;
6390
- if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
6391
- return;
6378
+ } else if (i > e2) {
6379
+ while (i <= e1) {
6380
+ unmount(c1[i], parentComponent, parentSuspense, true);
6381
+ i++;
6382
+ }
6383
+ } else {
6384
+ const s1 = i;
6385
+ const s2 = i;
6386
+ const keyToNewIndexMap = /* @__PURE__ */ new Map();
6387
+ for (i = s2; i <= e2; i++) {
6388
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
6389
+ if (nextChild.key != null) {
6390
+ if (!!(process.env.NODE_ENV !== "production") && keyToNewIndexMap.has(nextChild.key)) {
6391
+ warn$1(
6392
+ `Duplicate keys found during update:`,
6393
+ JSON.stringify(nextChild.key),
6394
+ `Make sure keys are unique.`
6395
+ );
6396
+ }
6397
+ keyToNewIndexMap.set(nextChild.key, i);
6392
6398
  }
6393
- const rawProps = i.vnode.props;
6394
- if (!(rawProps && // check if parent has passed v-model
6395
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
6396
- localValue = value;
6397
- trigger();
6399
+ }
6400
+ let j;
6401
+ let patched = 0;
6402
+ const toBePatched = e2 - s2 + 1;
6403
+ let moved = false;
6404
+ let maxNewIndexSoFar = 0;
6405
+ const newIndexToOldIndexMap = new Array(toBePatched);
6406
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
6407
+ for (i = s1; i <= e1; i++) {
6408
+ const prevChild = c1[i];
6409
+ if (patched >= toBePatched) {
6410
+ unmount(prevChild, parentComponent, parentSuspense, true);
6411
+ continue;
6398
6412
  }
6399
- i.emit(`update:${name}`, emittedValue);
6400
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
6401
- trigger();
6413
+ let newIndex;
6414
+ if (prevChild.key != null) {
6415
+ newIndex = keyToNewIndexMap.get(prevChild.key);
6416
+ } else {
6417
+ for (j = s2; j <= e2; j++) {
6418
+ if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
6419
+ newIndex = j;
6420
+ break;
6421
+ }
6422
+ }
6423
+ }
6424
+ if (newIndex === void 0) {
6425
+ unmount(prevChild, parentComponent, parentSuspense, true);
6426
+ } else {
6427
+ newIndexToOldIndexMap[newIndex - s2] = i + 1;
6428
+ if (newIndex >= maxNewIndexSoFar) {
6429
+ maxNewIndexSoFar = newIndex;
6430
+ } else {
6431
+ moved = true;
6432
+ }
6433
+ patch(
6434
+ prevChild,
6435
+ c2[newIndex],
6436
+ container,
6437
+ null,
6438
+ parentComponent,
6439
+ parentSuspense,
6440
+ namespace,
6441
+ slotScopeIds,
6442
+ optimized
6443
+ );
6444
+ patched++;
6402
6445
  }
6403
- prevSetValue = value;
6404
- prevEmittedValue = emittedValue;
6405
6446
  }
6406
- };
6407
- });
6408
- res[Symbol.iterator] = () => {
6409
- let i2 = 0;
6410
- return {
6411
- next() {
6412
- if (i2 < 2) {
6413
- return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
6414
- } else {
6415
- return { done: true };
6447
+ const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
6448
+ j = increasingNewIndexSequence.length - 1;
6449
+ for (i = toBePatched - 1; i >= 0; i--) {
6450
+ const nextIndex = s2 + i;
6451
+ const nextChild = c2[nextIndex];
6452
+ const anchorVNode = c2[nextIndex + 1];
6453
+ const anchor = nextIndex + 1 < l2 ? (
6454
+ // #13559, #14173 fallback to el placeholder for unresolved async component
6455
+ anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
6456
+ ) : parentAnchor;
6457
+ if (newIndexToOldIndexMap[i] === 0) {
6458
+ patch(
6459
+ null,
6460
+ nextChild,
6461
+ container,
6462
+ anchor,
6463
+ parentComponent,
6464
+ parentSuspense,
6465
+ namespace,
6466
+ slotScopeIds,
6467
+ optimized
6468
+ );
6469
+ } else if (moved) {
6470
+ if (j < 0 || i !== increasingNewIndexSequence[j]) {
6471
+ move(nextChild, container, anchor, 2);
6472
+ } else {
6473
+ j--;
6474
+ }
6416
6475
  }
6417
6476
  }
6418
- };
6477
+ }
6419
6478
  };
6420
- return res;
6421
- }
6422
- const getModelModifiers = (props, modelName) => {
6423
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
6424
- };
6425
-
6426
- function emit(instance, event, ...rawArgs) {
6427
- if (instance.isUnmounted) return;
6428
- const props = instance.vnode.props || EMPTY_OBJ;
6429
- if (!!(process.env.NODE_ENV !== "production")) {
6430
- const {
6431
- emitsOptions,
6432
- propsOptions: [propsOptions]
6433
- } = instance;
6434
- if (emitsOptions) {
6435
- if (!(event in emitsOptions) && true) {
6436
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6437
- warn$1(
6438
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
6439
- );
6440
- }
6479
+ const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
6480
+ const { el, type, transition, children, shapeFlag } = vnode;
6481
+ if (shapeFlag & 6) {
6482
+ move(vnode.component.subTree, container, anchor, moveType);
6483
+ return;
6484
+ }
6485
+ if (shapeFlag & 128) {
6486
+ vnode.suspense.move(container, anchor, moveType);
6487
+ return;
6488
+ }
6489
+ if (shapeFlag & 64) {
6490
+ type.move(vnode, container, anchor, internals);
6491
+ return;
6492
+ }
6493
+ if (type === Fragment) {
6494
+ hostInsert(el, container, anchor);
6495
+ for (let i = 0; i < children.length; i++) {
6496
+ move(children[i], container, anchor, moveType);
6497
+ }
6498
+ hostInsert(vnode.anchor, container, anchor);
6499
+ return;
6500
+ }
6501
+ if (type === Static) {
6502
+ moveStaticNode(vnode, container, anchor);
6503
+ return;
6504
+ }
6505
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
6506
+ if (needTransition2) {
6507
+ if (moveType === 0) {
6508
+ transition.beforeEnter(el);
6509
+ hostInsert(el, container, anchor);
6510
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
6441
6511
  } else {
6442
- const validator = emitsOptions[event];
6443
- if (isFunction(validator)) {
6444
- const isValid = validator(...rawArgs);
6445
- if (!isValid) {
6446
- warn$1(
6447
- `Invalid event arguments: event validation failed for event "${event}".`
6512
+ const { leave, delayLeave, afterLeave } = transition;
6513
+ const remove2 = () => {
6514
+ if (vnode.ctx.isUnmounted) {
6515
+ hostRemove(el);
6516
+ } else {
6517
+ hostInsert(el, container, anchor);
6518
+ }
6519
+ };
6520
+ const performLeave = () => {
6521
+ if (el._isLeaving) {
6522
+ el[leaveCbKey](
6523
+ true
6524
+ /* cancelled */
6448
6525
  );
6449
6526
  }
6527
+ leave(el, () => {
6528
+ remove2();
6529
+ afterLeave && afterLeave();
6530
+ });
6531
+ };
6532
+ if (delayLeave) {
6533
+ delayLeave(el, remove2, performLeave);
6534
+ } else {
6535
+ performLeave();
6450
6536
  }
6451
6537
  }
6538
+ } else {
6539
+ hostInsert(el, container, anchor);
6452
6540
  }
6453
- }
6454
- let args = rawArgs;
6455
- const isModelListener = event.startsWith("update:");
6456
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
6457
- if (modifiers) {
6458
- if (modifiers.trim) {
6459
- args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6541
+ };
6542
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6543
+ const {
6544
+ type,
6545
+ props,
6546
+ ref,
6547
+ children,
6548
+ dynamicChildren,
6549
+ shapeFlag,
6550
+ patchFlag,
6551
+ dirs,
6552
+ cacheIndex
6553
+ } = vnode;
6554
+ if (patchFlag === -2) {
6555
+ optimized = false;
6460
6556
  }
6461
- if (modifiers.number) {
6462
- args = rawArgs.map(looseToNumber);
6557
+ if (ref != null) {
6558
+ pauseTracking();
6559
+ setRef(ref, null, parentSuspense, vnode, true);
6560
+ resetTracking();
6463
6561
  }
6464
- }
6465
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6466
- devtoolsComponentEmit(instance, event, args);
6467
- }
6468
- if (!!(process.env.NODE_ENV !== "production")) {
6469
- const lowerCaseEvent = event.toLowerCase();
6470
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
6471
- warn$1(
6472
- `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
6473
- instance,
6474
- instance.type
6475
- )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
6476
- event
6477
- )}" instead of "${event}".`
6478
- );
6562
+ if (cacheIndex != null) {
6563
+ parentComponent.renderCache[cacheIndex] = void 0;
6479
6564
  }
6480
- }
6481
- let handlerName;
6482
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
6483
- props[handlerName = toHandlerKey(camelize(event))];
6484
- if (!handler && isModelListener) {
6485
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
6486
- }
6487
- if (handler) {
6488
- callWithAsyncErrorHandling(
6489
- handler,
6490
- instance,
6491
- 6,
6492
- args
6493
- );
6494
- }
6495
- const onceHandler = props[handlerName + `Once`];
6496
- if (onceHandler) {
6497
- if (!instance.emitted) {
6498
- instance.emitted = {};
6499
- } else if (instance.emitted[handlerName]) {
6565
+ if (shapeFlag & 256) {
6566
+ parentComponent.ctx.deactivate(vnode);
6567
+ return;
6568
+ }
6569
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
6570
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
6571
+ let vnodeHook;
6572
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
6573
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
6574
+ }
6575
+ if (shapeFlag & 6) {
6576
+ unmountComponent(vnode.component, parentSuspense, doRemove);
6577
+ } else {
6578
+ if (shapeFlag & 128) {
6579
+ vnode.suspense.unmount(parentSuspense, doRemove);
6580
+ return;
6581
+ }
6582
+ if (shouldInvokeDirs) {
6583
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6584
+ }
6585
+ if (shapeFlag & 64) {
6586
+ vnode.type.remove(
6587
+ vnode,
6588
+ parentComponent,
6589
+ parentSuspense,
6590
+ internals,
6591
+ doRemove
6592
+ );
6593
+ } else if (dynamicChildren && // #5154
6594
+ // when v-once is used inside a block, setBlockTracking(-1) marks the
6595
+ // parent block with hasOnce: true
6596
+ // so that it doesn't take the fast path during unmount - otherwise
6597
+ // components nested in v-once are never unmounted.
6598
+ !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
6599
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
6600
+ unmountChildren(
6601
+ dynamicChildren,
6602
+ parentComponent,
6603
+ parentSuspense,
6604
+ false,
6605
+ true
6606
+ );
6607
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
6608
+ unmountChildren(children, parentComponent, parentSuspense);
6609
+ }
6610
+ if (doRemove) {
6611
+ remove(vnode);
6612
+ }
6613
+ }
6614
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
6615
+ queuePostRenderEffect(() => {
6616
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6617
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6618
+ }, parentSuspense);
6619
+ }
6620
+ };
6621
+ const remove = (vnode) => {
6622
+ const { type, el, anchor, transition } = vnode;
6623
+ if (type === Fragment) {
6624
+ if (!!(process.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
6625
+ vnode.children.forEach((child) => {
6626
+ if (child.type === Comment) {
6627
+ hostRemove(child.el);
6628
+ } else {
6629
+ remove(child);
6630
+ }
6631
+ });
6632
+ } else {
6633
+ removeFragment(el, anchor);
6634
+ }
6500
6635
  return;
6501
6636
  }
6502
- instance.emitted[handlerName] = true;
6503
- callWithAsyncErrorHandling(
6504
- onceHandler,
6505
- instance,
6506
- 6,
6507
- args
6508
- );
6509
- }
6510
- }
6511
- const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
6512
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6513
- const cache = __VUE_OPTIONS_API__ && asMixin ? mixinEmitsCache : appContext.emitsCache;
6514
- const cached = cache.get(comp);
6515
- if (cached !== void 0) {
6516
- return cached;
6517
- }
6518
- const raw = comp.emits;
6519
- let normalized = {};
6520
- let hasExtends = false;
6521
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
6522
- const extendEmits = (raw2) => {
6523
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
6524
- if (normalizedFromExtend) {
6525
- hasExtends = true;
6526
- extend(normalized, normalizedFromExtend);
6637
+ if (type === Static) {
6638
+ removeStaticNode(vnode);
6639
+ return;
6640
+ }
6641
+ const performRemove = () => {
6642
+ hostRemove(el);
6643
+ if (transition && !transition.persisted && transition.afterLeave) {
6644
+ transition.afterLeave();
6527
6645
  }
6528
6646
  };
6529
- if (!asMixin && appContext.mixins.length) {
6530
- appContext.mixins.forEach(extendEmits);
6647
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6648
+ const { leave, delayLeave } = transition;
6649
+ const performLeave = () => leave(el, performRemove);
6650
+ if (delayLeave) {
6651
+ delayLeave(vnode.el, performRemove, performLeave);
6652
+ } else {
6653
+ performLeave();
6654
+ }
6655
+ } else {
6656
+ performRemove();
6531
6657
  }
6532
- if (comp.extends) {
6533
- extendEmits(comp.extends);
6658
+ };
6659
+ const removeFragment = (cur, end) => {
6660
+ let next;
6661
+ while (cur !== end) {
6662
+ next = hostNextSibling(cur);
6663
+ hostRemove(cur);
6664
+ cur = next;
6534
6665
  }
6535
- if (comp.mixins) {
6536
- comp.mixins.forEach(extendEmits);
6666
+ hostRemove(end);
6667
+ };
6668
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
6669
+ if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
6670
+ unregisterHMR(instance);
6537
6671
  }
6538
- }
6539
- if (!raw && !hasExtends) {
6540
- if (isObject(comp)) {
6541
- cache.set(comp, null);
6672
+ const { bum, scope, job, subTree, um, m, a } = instance;
6673
+ invalidateMount(m);
6674
+ invalidateMount(a);
6675
+ if (bum) {
6676
+ invokeArrayFns(bum);
6542
6677
  }
6543
- return null;
6544
- }
6545
- if (isArray(raw)) {
6546
- raw.forEach((key) => normalized[key] = null);
6547
- } else {
6548
- extend(normalized, raw);
6549
- }
6550
- if (isObject(comp)) {
6551
- cache.set(comp, normalized);
6552
- }
6553
- return normalized;
6554
- }
6555
- function isEmitListener(options, key) {
6556
- if (!options || !isOn(key)) {
6557
- return false;
6558
- }
6559
- key = key.slice(2).replace(/Once$/, "");
6560
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6561
- }
6562
-
6563
- let accessedAttrs = false;
6564
- function markAttrsAccessed() {
6565
- accessedAttrs = true;
6566
- }
6567
- function renderComponentRoot(instance) {
6568
- const {
6569
- type: Component,
6570
- vnode,
6571
- proxy,
6572
- withProxy,
6573
- propsOptions: [propsOptions],
6574
- slots,
6575
- attrs,
6576
- emit,
6577
- render,
6578
- renderCache,
6579
- props,
6580
- data,
6581
- setupState,
6582
- ctx,
6583
- inheritAttrs
6584
- } = instance;
6585
- const prev = setCurrentRenderingInstance(instance);
6586
- let result;
6587
- let fallthroughAttrs;
6588
- if (!!(process.env.NODE_ENV !== "production")) {
6589
- accessedAttrs = false;
6590
- }
6591
- try {
6592
- if (vnode.shapeFlag & 4) {
6593
- const proxyToUse = withProxy || proxy;
6594
- const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
6595
- get(target, key, receiver) {
6596
- warn$1(
6597
- `Property '${String(
6598
- key
6599
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
6600
- );
6601
- return Reflect.get(target, key, receiver);
6602
- }
6603
- }) : proxyToUse;
6604
- result = normalizeVNode(
6605
- render.call(
6606
- thisProxy,
6607
- proxyToUse,
6608
- renderCache,
6609
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6610
- setupState,
6611
- data,
6612
- ctx
6613
- )
6614
- );
6615
- fallthroughAttrs = attrs;
6616
- } else {
6617
- const render2 = Component;
6618
- if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
6619
- markAttrsAccessed();
6620
- }
6621
- result = normalizeVNode(
6622
- render2.length > 1 ? render2(
6623
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6624
- !!(process.env.NODE_ENV !== "production") ? {
6625
- get attrs() {
6626
- markAttrsAccessed();
6627
- return shallowReadonly(attrs);
6628
- },
6629
- slots,
6630
- emit
6631
- } : { attrs, slots, emit }
6632
- ) : render2(
6633
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6634
- null
6635
- )
6636
- );
6637
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
6678
+ scope.stop();
6679
+ if (job) {
6680
+ job.flags |= 8;
6681
+ unmount(subTree, instance, parentSuspense, doRemove);
6638
6682
  }
6639
- } catch (err) {
6640
- blockStack.length = 0;
6641
- handleError(err, instance, 1);
6642
- result = createVNode(Comment);
6643
- }
6644
- let root = result;
6645
- let setRoot = void 0;
6646
- if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
6647
- [root, setRoot] = getChildRoot(result);
6648
- }
6649
- if (fallthroughAttrs && inheritAttrs !== false) {
6650
- const keys = Object.keys(fallthroughAttrs);
6651
- const { shapeFlag } = root;
6652
- if (keys.length) {
6653
- if (shapeFlag & (1 | 6)) {
6654
- if (propsOptions && keys.some(isModelListener)) {
6655
- fallthroughAttrs = filterModelListeners(
6656
- fallthroughAttrs,
6657
- propsOptions
6658
- );
6659
- }
6660
- root = cloneVNode(root, fallthroughAttrs, false, true);
6661
- } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
6662
- const allAttrs = Object.keys(attrs);
6663
- const eventAttrs = [];
6664
- const extraAttrs = [];
6665
- for (let i = 0, l = allAttrs.length; i < l; i++) {
6666
- const key = allAttrs[i];
6667
- if (isOn(key)) {
6668
- if (!isModelListener(key)) {
6669
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
6670
- }
6671
- } else {
6672
- extraAttrs.push(key);
6673
- }
6674
- }
6675
- if (extraAttrs.length) {
6676
- warn$1(
6677
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
6678
- );
6679
- }
6680
- if (eventAttrs.length) {
6681
- warn$1(
6682
- `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
6683
- );
6684
- }
6685
- }
6683
+ if (um) {
6684
+ queuePostRenderEffect(um, parentSuspense);
6686
6685
  }
6687
- }
6688
- if (vnode.dirs) {
6689
- if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
6690
- warn$1(
6691
- `Runtime directive used on component with non-element root node. The directives will not function as intended.`
6686
+ queuePostRenderEffect(() => {
6687
+ instance.isUnmounted = true;
6688
+ }, parentSuspense);
6689
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6690
+ devtoolsComponentRemoved(instance);
6691
+ }
6692
+ };
6693
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
6694
+ for (let i = start; i < children.length; i++) {
6695
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
6696
+ }
6697
+ };
6698
+ const getNextHostNode = (vnode) => {
6699
+ if (vnode.shapeFlag & 6) {
6700
+ return getNextHostNode(vnode.component.subTree);
6701
+ }
6702
+ if (vnode.shapeFlag & 128) {
6703
+ return vnode.suspense.next();
6704
+ }
6705
+ const el = hostNextSibling(vnode.anchor || vnode.el);
6706
+ const teleportEnd = el && el[TeleportEndKey];
6707
+ return teleportEnd ? hostNextSibling(teleportEnd) : el;
6708
+ };
6709
+ let isFlushing = false;
6710
+ const render = (vnode, container, namespace) => {
6711
+ let instance;
6712
+ if (vnode == null) {
6713
+ if (container._vnode) {
6714
+ unmount(container._vnode, null, null, true);
6715
+ instance = container._vnode.component;
6716
+ }
6717
+ } else {
6718
+ patch(
6719
+ container._vnode || null,
6720
+ vnode,
6721
+ container,
6722
+ null,
6723
+ null,
6724
+ null,
6725
+ namespace
6692
6726
  );
6693
6727
  }
6694
- root = cloneVNode(root, null, false, true);
6695
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
6696
- }
6697
- if (vnode.transition) {
6698
- if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
6699
- warn$1(
6700
- `Component inside <Transition> renders non-element root node that cannot be animated.`
6701
- );
6728
+ container._vnode = vnode;
6729
+ if (!isFlushing) {
6730
+ isFlushing = true;
6731
+ flushPreFlushCbs(instance);
6732
+ flushPostFlushCbs();
6733
+ isFlushing = false;
6702
6734
  }
6703
- setTransitionHooks(root, vnode.transition);
6735
+ };
6736
+ const internals = {
6737
+ p: patch,
6738
+ um: unmount,
6739
+ m: move,
6740
+ r: remove,
6741
+ mt: mountComponent,
6742
+ mc: mountChildren,
6743
+ pc: patchChildren,
6744
+ pbc: patchBlockChildren,
6745
+ n: getNextHostNode,
6746
+ o: options
6747
+ };
6748
+ let hydrate;
6749
+ let hydrateNode;
6750
+ if (createHydrationFns) {
6751
+ [hydrate, hydrateNode] = createHydrationFns(
6752
+ internals
6753
+ );
6704
6754
  }
6705
- if (!!(process.env.NODE_ENV !== "production") && setRoot) {
6706
- setRoot(root);
6755
+ return {
6756
+ render,
6757
+ hydrate,
6758
+ createApp: createAppAPI(render, hydrate)
6759
+ };
6760
+ }
6761
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
6762
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6763
+ }
6764
+ function toggleRecurse({ effect, job }, allowed) {
6765
+ if (allowed) {
6766
+ effect.flags |= 32;
6767
+ job.flags |= 4;
6707
6768
  } else {
6708
- result = root;
6769
+ effect.flags &= -33;
6770
+ job.flags &= -5;
6709
6771
  }
6710
- setCurrentRenderingInstance(prev);
6711
- return result;
6712
6772
  }
6713
- const getChildRoot = (vnode) => {
6714
- const rawChildren = vnode.children;
6715
- const dynamicChildren = vnode.dynamicChildren;
6716
- const childRoot = filterSingleRoot(rawChildren, false);
6717
- if (!childRoot) {
6718
- return [vnode, void 0];
6719
- } else if (!!(process.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
6720
- return getChildRoot(childRoot);
6721
- }
6722
- const index = rawChildren.indexOf(childRoot);
6723
- const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
6724
- const setRoot = (updatedRoot) => {
6725
- rawChildren[index] = updatedRoot;
6726
- if (dynamicChildren) {
6727
- if (dynamicIndex > -1) {
6728
- dynamicChildren[dynamicIndex] = updatedRoot;
6729
- } else if (updatedRoot.patchFlag > 0) {
6730
- vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
6773
+ function needTransition(parentSuspense, transition) {
6774
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6775
+ }
6776
+ function traverseStaticChildren(n1, n2, shallow = false) {
6777
+ const ch1 = n1.children;
6778
+ const ch2 = n2.children;
6779
+ if (isArray(ch1) && isArray(ch2)) {
6780
+ for (let i = 0; i < ch1.length; i++) {
6781
+ const c1 = ch1[i];
6782
+ let c2 = ch2[i];
6783
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
6784
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
6785
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
6786
+ c2.el = c1.el;
6787
+ }
6788
+ if (!shallow && c2.patchFlag !== -2)
6789
+ traverseStaticChildren(c1, c2);
6731
6790
  }
6732
- }
6733
- };
6734
- return [normalizeVNode(childRoot), setRoot];
6735
- };
6736
- function filterSingleRoot(children, recurse = true) {
6737
- let singleRoot;
6738
- for (let i = 0; i < children.length; i++) {
6739
- const child = children[i];
6740
- if (isVNode(child)) {
6741
- if (child.type !== Comment || child.children === "v-if") {
6742
- if (singleRoot) {
6743
- return;
6791
+ if (c2.type === Text) {
6792
+ if (c2.patchFlag !== -1) {
6793
+ c2.el = c1.el;
6744
6794
  } else {
6745
- singleRoot = child;
6746
- if (!!(process.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
6747
- return filterSingleRoot(singleRoot.children);
6748
- }
6795
+ c2.__elIndex = i + // take fragment start anchor into account
6796
+ (n1.type === Fragment ? 1 : 0);
6749
6797
  }
6750
6798
  }
6751
- } else {
6752
- return;
6799
+ if (c2.type === Comment && !c2.el) {
6800
+ c2.el = c1.el;
6801
+ }
6802
+ if (!!(process.env.NODE_ENV !== "production")) {
6803
+ c2.el && (c2.el.__vnode = c2);
6804
+ }
6753
6805
  }
6754
6806
  }
6755
- return singleRoot;
6756
6807
  }
6757
- const getFunctionalFallthrough = (attrs) => {
6758
- let res;
6759
- for (const key in attrs) {
6760
- if (key === "class" || key === "style" || isOn(key)) {
6761
- (res || (res = {}))[key] = attrs[key];
6762
- }
6763
- }
6764
- return res;
6765
- };
6766
- const filterModelListeners = (attrs, props) => {
6767
- const res = {};
6768
- for (const key in attrs) {
6769
- if (!isModelListener(key) || !(key.slice(9) in props)) {
6770
- res[key] = attrs[key];
6771
- }
6772
- }
6773
- return res;
6774
- };
6775
- const isElementRoot = (vnode) => {
6776
- return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
6777
- };
6778
- function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
6779
- const { props: prevProps, children: prevChildren, component } = prevVNode;
6780
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
6781
- const emits = component.emitsOptions;
6782
- if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
6783
- return true;
6784
- }
6785
- if (nextVNode.dirs || nextVNode.transition) {
6786
- return true;
6787
- }
6788
- if (optimized && patchFlag >= 0) {
6789
- if (patchFlag & 1024) {
6790
- return true;
6791
- }
6792
- if (patchFlag & 16) {
6793
- if (!prevProps) {
6794
- return !!nextProps;
6808
+ function getSequence(arr) {
6809
+ const p = arr.slice();
6810
+ const result = [0];
6811
+ let i, j, u, v, c;
6812
+ const len = arr.length;
6813
+ for (i = 0; i < len; i++) {
6814
+ const arrI = arr[i];
6815
+ if (arrI !== 0) {
6816
+ j = result[result.length - 1];
6817
+ if (arr[j] < arrI) {
6818
+ p[i] = j;
6819
+ result.push(i);
6820
+ continue;
6795
6821
  }
6796
- return hasPropsChanged(prevProps, nextProps, emits);
6797
- } else if (patchFlag & 8) {
6798
- const dynamicProps = nextVNode.dynamicProps;
6799
- for (let i = 0; i < dynamicProps.length; i++) {
6800
- const key = dynamicProps[i];
6801
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
6802
- return true;
6822
+ u = 0;
6823
+ v = result.length - 1;
6824
+ while (u < v) {
6825
+ c = u + v >> 1;
6826
+ if (arr[result[c]] < arrI) {
6827
+ u = c + 1;
6828
+ } else {
6829
+ v = c;
6803
6830
  }
6804
6831
  }
6805
- }
6806
- } else {
6807
- if (prevChildren || nextChildren) {
6808
- if (!nextChildren || !nextChildren.$stable) {
6809
- return true;
6832
+ if (arrI < arr[result[u]]) {
6833
+ if (u > 0) {
6834
+ p[i] = result[u - 1];
6835
+ }
6836
+ result[u] = i;
6810
6837
  }
6811
6838
  }
6812
- if (prevProps === nextProps) {
6813
- return false;
6814
- }
6815
- if (!prevProps) {
6816
- return !!nextProps;
6817
- }
6818
- if (!nextProps) {
6819
- return true;
6820
- }
6821
- return hasPropsChanged(prevProps, nextProps, emits);
6822
- }
6823
- return false;
6824
- }
6825
- function hasPropsChanged(prevProps, nextProps, emitsOptions) {
6826
- const nextKeys = Object.keys(nextProps);
6827
- if (nextKeys.length !== Object.keys(prevProps).length) {
6828
- return true;
6829
6839
  }
6830
- for (let i = 0; i < nextKeys.length; i++) {
6831
- const key = nextKeys[i];
6832
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
6833
- return true;
6834
- }
6840
+ u = result.length;
6841
+ v = result[u - 1];
6842
+ while (u-- > 0) {
6843
+ result[u] = v;
6844
+ v = p[v];
6835
6845
  }
6836
- return false;
6846
+ return result;
6837
6847
  }
6838
- function updateHOCHostEl({ vnode, parent }, el) {
6839
- while (parent) {
6840
- const root = parent.subTree;
6841
- if (root.suspense && root.suspense.activeBranch === vnode) {
6842
- root.el = vnode.el;
6843
- }
6844
- if (root === vnode) {
6845
- (vnode = parent.vnode).el = el;
6846
- parent = parent.parent;
6848
+ function locateNonHydratedAsyncRoot(instance) {
6849
+ const subComponent = instance.subTree.component;
6850
+ if (subComponent) {
6851
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
6852
+ return subComponent;
6847
6853
  } else {
6848
- break;
6854
+ return locateNonHydratedAsyncRoot(subComponent);
6849
6855
  }
6850
6856
  }
6851
6857
  }
6858
+ function invalidateMount(hooks) {
6859
+ if (hooks) {
6860
+ for (let i = 0; i < hooks.length; i++)
6861
+ hooks[i].flags |= 8;
6862
+ }
6863
+ }
6864
+ function resolveAsyncComponentPlaceholder(anchorVnode) {
6865
+ if (anchorVnode.placeholder) {
6866
+ return anchorVnode.placeholder;
6867
+ }
6868
+ const instance = anchorVnode.component;
6869
+ if (instance) {
6870
+ return resolveAsyncComponentPlaceholder(instance.subTree);
6871
+ }
6872
+ return null;
6873
+ }
6852
6874
 
6853
6875
  const isSuspense = (type) => type.__isSuspense;
6854
6876
  let suspenseId = 0;
@@ -7203,7 +7225,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7203
7225
  }
7204
7226
  unmount(activeBranch, parentComponent2, suspense, true);
7205
7227
  if (!delayEnter && isInFallback && vnode2.ssFallback) {
7206
- vnode2.ssFallback.el = null;
7228
+ queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense);
7207
7229
  }
7208
7230
  }
7209
7231
  if (!delayEnter) {
@@ -7451,10 +7473,10 @@ function isVNodeSuspensible(vnode) {
7451
7473
  return suspensible != null && suspensible !== false;
7452
7474
  }
7453
7475
 
7454
- const Fragment = Symbol.for("v-fgt");
7455
- const Text = Symbol.for("v-txt");
7456
- const Comment = Symbol.for("v-cmt");
7457
- const Static = Symbol.for("v-stc");
7476
+ const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
7477
+ const Text = /* @__PURE__ */ Symbol.for("v-txt");
7478
+ const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
7479
+ const Static = /* @__PURE__ */ Symbol.for("v-stc");
7458
7480
  const blockStack = [];
7459
7481
  let currentBlock = null;
7460
7482
  function openBlock(disableTracking = false) {
@@ -7982,7 +8004,6 @@ function setupComponent(instance, isSSR = false, optimized = false) {
7982
8004
  return setupResult;
7983
8005
  }
7984
8006
  function setupStatefulComponent(instance, isSSR) {
7985
- var _a;
7986
8007
  const Component = instance.type;
7987
8008
  if (!!(process.env.NODE_ENV !== "production")) {
7988
8009
  if (Component.name) {
@@ -8042,7 +8063,7 @@ function setupStatefulComponent(instance, isSSR) {
8042
8063
  } else {
8043
8064
  instance.asyncDep = setupResult;
8044
8065
  if (!!(process.env.NODE_ENV !== "production") && !instance.suspense) {
8045
- const name = (_a = Component.name) != null ? _a : "Anonymous";
8066
+ const name = formatComponentName(instance, Component);
8046
8067
  warn$1(
8047
8068
  `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
8048
8069
  );
@@ -8252,7 +8273,7 @@ function formatComponentName(instance, Component, isRoot = false) {
8252
8273
  name = match[1];
8253
8274
  }
8254
8275
  }
8255
- if (!name && instance && instance.parent) {
8276
+ if (!name && instance) {
8256
8277
  const inferFromRegistry = (registry) => {
8257
8278
  for (const key in registry) {
8258
8279
  if (registry[key] === Component) {
@@ -8260,8 +8281,8 @@ function formatComponentName(instance, Component, isRoot = false) {
8260
8281
  }
8261
8282
  }
8262
8283
  };
8263
- name = inferFromRegistry(
8264
- instance.components || instance.parent.type.components
8284
+ name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
8285
+ instance.parent.type.components
8265
8286
  ) || inferFromRegistry(instance.appContext.components);
8266
8287
  }
8267
8288
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
@@ -8513,7 +8534,7 @@ function isMemoSame(cached, memo) {
8513
8534
  return true;
8514
8535
  }
8515
8536
 
8516
- const version = "3.5.24";
8537
+ const version = "3.5.26";
8517
8538
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8518
8539
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8519
8540
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;