@vue/compat 3.3.0-alpha.7 → 3.3.0-alpha.9

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.
@@ -3536,33 +3536,41 @@ function setActiveBranch(suspense, branch) {
3536
3536
  }
3537
3537
  }
3538
3538
 
3539
- function provide(key, value) {
3540
- if (!currentInstance) {
3541
- {
3542
- warn(`provide() can only be used inside setup().`);
3543
- }
3544
- } else {
3545
- let provides = currentInstance.provides;
3546
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3547
- if (parentProvides === provides) {
3548
- provides = currentInstance.provides = Object.create(parentProvides);
3549
- }
3550
- provides[key] = value;
3551
- }
3552
- }
3553
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3554
- const instance = currentInstance || currentRenderingInstance;
3555
- if (instance) {
3556
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3557
- if (provides && key in provides) {
3558
- return provides[key];
3559
- } else if (arguments.length > 1) {
3560
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3539
+ const legacyDirectiveHookMap = {
3540
+ beforeMount: "bind",
3541
+ mounted: "inserted",
3542
+ updated: ["update", "componentUpdated"],
3543
+ unmounted: "unbind"
3544
+ };
3545
+ function mapCompatDirectiveHook(name, dir, instance) {
3546
+ const mappedName = legacyDirectiveHookMap[name];
3547
+ if (mappedName) {
3548
+ if (isArray(mappedName)) {
3549
+ const hook = [];
3550
+ mappedName.forEach((mapped) => {
3551
+ const mappedHook = dir[mapped];
3552
+ if (mappedHook) {
3553
+ softAssertCompatEnabled(
3554
+ "CUSTOM_DIR",
3555
+ instance,
3556
+ mapped,
3557
+ name
3558
+ );
3559
+ hook.push(mappedHook);
3560
+ }
3561
+ });
3562
+ return hook.length ? hook : void 0;
3561
3563
  } else {
3562
- warn(`injection "${String(key)}" not found.`);
3564
+ if (dir[mappedName]) {
3565
+ softAssertCompatEnabled(
3566
+ "CUSTOM_DIR",
3567
+ instance,
3568
+ mappedName,
3569
+ name
3570
+ );
3571
+ }
3572
+ return dir[mappedName];
3563
3573
  }
3564
- } else {
3565
- warn(`inject() can only be used inside setup() or functional components.`);
3566
3574
  }
3567
3575
  }
3568
3576
 
@@ -3801,6 +3809,68 @@ function traverse(value, seen) {
3801
3809
  return value;
3802
3810
  }
3803
3811
 
3812
+ function validateDirectiveName(name) {
3813
+ if (isBuiltInDirective(name)) {
3814
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3815
+ }
3816
+ }
3817
+ function withDirectives(vnode, directives) {
3818
+ const internalInstance = currentRenderingInstance;
3819
+ if (internalInstance === null) {
3820
+ warn(`withDirectives can only be used inside render functions.`);
3821
+ return vnode;
3822
+ }
3823
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3824
+ const bindings = vnode.dirs || (vnode.dirs = []);
3825
+ for (let i = 0; i < directives.length; i++) {
3826
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3827
+ if (dir) {
3828
+ if (isFunction(dir)) {
3829
+ dir = {
3830
+ mounted: dir,
3831
+ updated: dir
3832
+ };
3833
+ }
3834
+ if (dir.deep) {
3835
+ traverse(value);
3836
+ }
3837
+ bindings.push({
3838
+ dir,
3839
+ instance,
3840
+ value,
3841
+ oldValue: void 0,
3842
+ arg,
3843
+ modifiers
3844
+ });
3845
+ }
3846
+ }
3847
+ return vnode;
3848
+ }
3849
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3850
+ const bindings = vnode.dirs;
3851
+ const oldBindings = prevVNode && prevVNode.dirs;
3852
+ for (let i = 0; i < bindings.length; i++) {
3853
+ const binding = bindings[i];
3854
+ if (oldBindings) {
3855
+ binding.oldValue = oldBindings[i].value;
3856
+ }
3857
+ let hook = binding.dir[name];
3858
+ if (!hook) {
3859
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3860
+ }
3861
+ if (hook) {
3862
+ pauseTracking();
3863
+ callWithAsyncErrorHandling(hook, instance, 8, [
3864
+ vnode.el,
3865
+ binding,
3866
+ vnode,
3867
+ prevVNode
3868
+ ]);
3869
+ resetTracking();
3870
+ }
3871
+ }
3872
+ }
3873
+
3804
3874
  function useTransitionState() {
3805
3875
  const state = {
3806
3876
  isMounted: false,
@@ -4599,106 +4669,6 @@ function getCompatListeners(instance) {
4599
4669
  return listeners;
4600
4670
  }
4601
4671
 
4602
- const legacyDirectiveHookMap = {
4603
- beforeMount: "bind",
4604
- mounted: "inserted",
4605
- updated: ["update", "componentUpdated"],
4606
- unmounted: "unbind"
4607
- };
4608
- function mapCompatDirectiveHook(name, dir, instance) {
4609
- const mappedName = legacyDirectiveHookMap[name];
4610
- if (mappedName) {
4611
- if (isArray(mappedName)) {
4612
- const hook = [];
4613
- mappedName.forEach((mapped) => {
4614
- const mappedHook = dir[mapped];
4615
- if (mappedHook) {
4616
- softAssertCompatEnabled(
4617
- "CUSTOM_DIR",
4618
- instance,
4619
- mapped,
4620
- name
4621
- );
4622
- hook.push(mappedHook);
4623
- }
4624
- });
4625
- return hook.length ? hook : void 0;
4626
- } else {
4627
- if (dir[mappedName]) {
4628
- softAssertCompatEnabled(
4629
- "CUSTOM_DIR",
4630
- instance,
4631
- mappedName,
4632
- name
4633
- );
4634
- }
4635
- return dir[mappedName];
4636
- }
4637
- }
4638
- }
4639
-
4640
- function validateDirectiveName(name) {
4641
- if (isBuiltInDirective(name)) {
4642
- warn("Do not use built-in directive ids as custom directive id: " + name);
4643
- }
4644
- }
4645
- function withDirectives(vnode, directives) {
4646
- const internalInstance = currentRenderingInstance;
4647
- if (internalInstance === null) {
4648
- warn(`withDirectives can only be used inside render functions.`);
4649
- return vnode;
4650
- }
4651
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4652
- const bindings = vnode.dirs || (vnode.dirs = []);
4653
- for (let i = 0; i < directives.length; i++) {
4654
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4655
- if (dir) {
4656
- if (isFunction(dir)) {
4657
- dir = {
4658
- mounted: dir,
4659
- updated: dir
4660
- };
4661
- }
4662
- if (dir.deep) {
4663
- traverse(value);
4664
- }
4665
- bindings.push({
4666
- dir,
4667
- instance,
4668
- value,
4669
- oldValue: void 0,
4670
- arg,
4671
- modifiers
4672
- });
4673
- }
4674
- }
4675
- return vnode;
4676
- }
4677
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4678
- const bindings = vnode.dirs;
4679
- const oldBindings = prevVNode && prevVNode.dirs;
4680
- for (let i = 0; i < bindings.length; i++) {
4681
- const binding = bindings[i];
4682
- if (oldBindings) {
4683
- binding.oldValue = oldBindings[i].value;
4684
- }
4685
- let hook = binding.dir[name];
4686
- if (!hook) {
4687
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4688
- }
4689
- if (hook) {
4690
- pauseTracking();
4691
- callWithAsyncErrorHandling(hook, instance, 8, [
4692
- vnode.el,
4693
- binding,
4694
- vnode,
4695
- prevVNode
4696
- ]);
4697
- resetTracking();
4698
- }
4699
- }
4700
- }
4701
-
4702
4672
  const COMPONENTS = "components";
4703
4673
  const DIRECTIVES = "directives";
4704
4674
  const FILTERS = "filters";
@@ -6039,1179 +6009,1218 @@ function mergeWatchOptions(to, from) {
6039
6009
  return merged;
6040
6010
  }
6041
6011
 
6042
- function createPropsDefaultThis(instance, rawProps, propKey) {
6043
- return new Proxy(
6044
- {},
6045
- {
6046
- get(_, key) {
6047
- warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6048
- if (key === "$options") {
6049
- return resolveMergedOptions(instance);
6050
- }
6051
- if (key in rawProps) {
6052
- return rawProps[key];
6053
- }
6054
- const injections = instance.type.inject;
6055
- if (injections) {
6056
- if (isArray(injections)) {
6057
- if (injections.includes(key)) {
6058
- return inject(key);
6059
- }
6060
- } else if (key in injections) {
6061
- return inject(key);
6062
- }
6012
+ function installLegacyConfigWarnings(config) {
6013
+ const legacyConfigOptions = {
6014
+ silent: "CONFIG_SILENT",
6015
+ devtools: "CONFIG_DEVTOOLS",
6016
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6017
+ keyCodes: "CONFIG_KEY_CODES",
6018
+ productionTip: "CONFIG_PRODUCTION_TIP"
6019
+ };
6020
+ Object.keys(legacyConfigOptions).forEach((key) => {
6021
+ let val = config[key];
6022
+ Object.defineProperty(config, key, {
6023
+ enumerable: true,
6024
+ get() {
6025
+ return val;
6026
+ },
6027
+ set(newVal) {
6028
+ if (!isCopyingConfig) {
6029
+ warnDeprecation$1(legacyConfigOptions[key], null);
6063
6030
  }
6031
+ val = newVal;
6064
6032
  }
6065
- }
6066
- );
6033
+ });
6034
+ });
6067
6035
  }
6068
-
6069
- function shouldSkipAttr(key, instance) {
6070
- if (key === "is") {
6071
- return true;
6072
- }
6073
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6074
- return true;
6075
- }
6076
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6077
- return true;
6078
- }
6079
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6080
- return true;
6081
- }
6082
- return false;
6036
+ function installLegacyOptionMergeStrats(config) {
6037
+ config.optionMergeStrategies = new Proxy({}, {
6038
+ get(target, key) {
6039
+ if (key in target) {
6040
+ return target[key];
6041
+ }
6042
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6043
+ "CONFIG_OPTION_MERGE_STRATS",
6044
+ null
6045
+ )) {
6046
+ return internalOptionMergeStrats[key];
6047
+ }
6048
+ }
6049
+ });
6083
6050
  }
6084
6051
 
6085
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6086
- const props = {};
6087
- const attrs = {};
6088
- def(attrs, InternalObjectKey, 1);
6089
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6090
- setFullProps(instance, rawProps, props, attrs);
6091
- for (const key in instance.propsOptions[0]) {
6092
- if (!(key in props)) {
6093
- props[key] = void 0;
6052
+ let isCopyingConfig = false;
6053
+ let singletonApp;
6054
+ let singletonCtor;
6055
+ function createCompatVue$1(createApp, createSingletonApp) {
6056
+ singletonApp = createSingletonApp({});
6057
+ const Vue = singletonCtor = function Vue2(options = {}) {
6058
+ return createCompatApp(options, Vue2);
6059
+ };
6060
+ function createCompatApp(options = {}, Ctor) {
6061
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6062
+ const { data } = options;
6063
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6064
+ options.data = () => data;
6094
6065
  }
6095
- }
6096
- {
6097
- validateProps(rawProps || {}, props, instance);
6098
- }
6099
- if (isStateful) {
6100
- instance.props = isSSR ? props : shallowReactive(props);
6101
- } else {
6102
- if (!instance.type.props) {
6103
- instance.props = attrs;
6066
+ const app = createApp(options);
6067
+ if (Ctor !== Vue) {
6068
+ applySingletonPrototype(app, Ctor);
6069
+ }
6070
+ const vm = app._createRoot(options);
6071
+ if (options.el) {
6072
+ return vm.$mount(options.el);
6104
6073
  } else {
6105
- instance.props = props;
6074
+ return vm;
6106
6075
  }
6107
6076
  }
6108
- instance.attrs = attrs;
6109
- }
6110
- function isInHmrContext(instance) {
6111
- while (instance) {
6112
- if (instance.type.__hmrId)
6113
- return true;
6114
- instance = instance.parent;
6115
- }
6116
- }
6117
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6118
- const {
6119
- props,
6120
- attrs,
6121
- vnode: { patchFlag }
6122
- } = instance;
6123
- const rawCurrentProps = toRaw(props);
6124
- const [options] = instance.propsOptions;
6125
- let hasAttrsChanged = false;
6126
- if (
6127
- // always force full diff in dev
6128
- // - #1942 if hmr is enabled with sfc component
6129
- // - vite#872 non-sfc component used by sfc component
6130
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6131
- ) {
6132
- if (patchFlag & 8) {
6133
- const propsToUpdate = instance.vnode.dynamicProps;
6134
- for (let i = 0; i < propsToUpdate.length; i++) {
6135
- let key = propsToUpdate[i];
6136
- if (isEmitListener(instance.emitsOptions, key)) {
6137
- continue;
6138
- }
6139
- const value = rawProps[key];
6140
- if (options) {
6141
- if (hasOwn(attrs, key)) {
6142
- if (value !== attrs[key]) {
6143
- attrs[key] = value;
6144
- hasAttrsChanged = true;
6145
- }
6146
- } else {
6147
- const camelizedKey = camelize(key);
6148
- props[camelizedKey] = resolvePropValue(
6149
- options,
6150
- rawCurrentProps,
6151
- camelizedKey,
6152
- value,
6153
- instance,
6154
- false
6155
- /* isAbsent */
6156
- );
6157
- }
6158
- } else {
6159
- {
6160
- if (isOn(key) && key.endsWith("Native")) {
6161
- key = key.slice(0, -6);
6162
- } else if (shouldSkipAttr(key, instance)) {
6163
- continue;
6164
- }
6165
- }
6166
- if (value !== attrs[key]) {
6167
- attrs[key] = value;
6168
- hasAttrsChanged = true;
6169
- }
6170
- }
6171
- }
6077
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.9"}`;
6078
+ Vue.config = singletonApp.config;
6079
+ Vue.use = (p, ...options) => {
6080
+ if (p && isFunction(p.install)) {
6081
+ p.install(Vue, ...options);
6082
+ } else if (isFunction(p)) {
6083
+ p(Vue, ...options);
6172
6084
  }
6173
- } else {
6174
- if (setFullProps(instance, rawProps, props, attrs)) {
6175
- hasAttrsChanged = true;
6085
+ return Vue;
6086
+ };
6087
+ Vue.mixin = (m) => {
6088
+ singletonApp.mixin(m);
6089
+ return Vue;
6090
+ };
6091
+ Vue.component = (name, comp) => {
6092
+ if (comp) {
6093
+ singletonApp.component(name, comp);
6094
+ return Vue;
6095
+ } else {
6096
+ return singletonApp.component(name);
6176
6097
  }
6177
- let kebabKey;
6178
- for (const key in rawCurrentProps) {
6179
- if (!rawProps || // for camelCase
6180
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6181
- // and converted to camelCase (#955)
6182
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6183
- if (options) {
6184
- if (rawPrevProps && // for camelCase
6185
- (rawPrevProps[key] !== void 0 || // for kebab-case
6186
- rawPrevProps[kebabKey] !== void 0)) {
6187
- props[key] = resolvePropValue(
6188
- options,
6189
- rawCurrentProps,
6190
- key,
6191
- void 0,
6192
- instance,
6193
- true
6194
- /* isAbsent */
6195
- );
6196
- }
6197
- } else {
6198
- delete props[key];
6199
- }
6200
- }
6098
+ };
6099
+ Vue.directive = (name, dir) => {
6100
+ if (dir) {
6101
+ singletonApp.directive(name, dir);
6102
+ return Vue;
6103
+ } else {
6104
+ return singletonApp.directive(name);
6201
6105
  }
6202
- if (attrs !== rawCurrentProps) {
6203
- for (const key in attrs) {
6204
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6205
- delete attrs[key];
6206
- hasAttrsChanged = true;
6207
- }
6106
+ };
6107
+ Vue.options = { _base: Vue };
6108
+ let cid = 1;
6109
+ Vue.cid = cid;
6110
+ Vue.nextTick = nextTick;
6111
+ const extendCache = /* @__PURE__ */ new WeakMap();
6112
+ function extendCtor(extendOptions = {}) {
6113
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6114
+ if (isFunction(extendOptions)) {
6115
+ extendOptions = extendOptions.options;
6116
+ }
6117
+ if (extendCache.has(extendOptions)) {
6118
+ return extendCache.get(extendOptions);
6119
+ }
6120
+ const Super = this;
6121
+ function SubVue(inlineOptions) {
6122
+ if (!inlineOptions) {
6123
+ return createCompatApp(SubVue.options, SubVue);
6124
+ } else {
6125
+ return createCompatApp(
6126
+ mergeOptions(
6127
+ extend({}, SubVue.options),
6128
+ inlineOptions,
6129
+ internalOptionMergeStrats
6130
+ ),
6131
+ SubVue
6132
+ );
6208
6133
  }
6209
6134
  }
6135
+ SubVue.super = Super;
6136
+ SubVue.prototype = Object.create(Vue.prototype);
6137
+ SubVue.prototype.constructor = SubVue;
6138
+ const mergeBase = {};
6139
+ for (const key in Super.options) {
6140
+ const superValue = Super.options[key];
6141
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6142
+ }
6143
+ SubVue.options = mergeOptions(
6144
+ mergeBase,
6145
+ extendOptions,
6146
+ internalOptionMergeStrats
6147
+ );
6148
+ SubVue.options._base = SubVue;
6149
+ SubVue.extend = extendCtor.bind(SubVue);
6150
+ SubVue.mixin = Super.mixin;
6151
+ SubVue.use = Super.use;
6152
+ SubVue.cid = ++cid;
6153
+ extendCache.set(extendOptions, SubVue);
6154
+ return SubVue;
6210
6155
  }
6211
- if (hasAttrsChanged) {
6212
- trigger(instance, "set", "$attrs");
6213
- }
6214
- {
6215
- validateProps(rawProps || {}, props, instance);
6216
- }
6217
- }
6218
- function setFullProps(instance, rawProps, props, attrs) {
6219
- const [options, needCastKeys] = instance.propsOptions;
6220
- let hasAttrsChanged = false;
6221
- let rawCastValues;
6222
- if (rawProps) {
6223
- for (let key in rawProps) {
6224
- if (isReservedProp(key)) {
6225
- continue;
6226
- }
6227
- {
6228
- if (key.startsWith("onHook:")) {
6229
- softAssertCompatEnabled(
6230
- "INSTANCE_EVENT_HOOKS",
6231
- instance,
6232
- key.slice(2).toLowerCase()
6233
- );
6234
- }
6235
- if (key === "inline-template") {
6236
- continue;
6237
- }
6238
- }
6239
- const value = rawProps[key];
6240
- let camelKey;
6241
- if (options && hasOwn(options, camelKey = camelize(key))) {
6242
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6243
- props[camelKey] = value;
6244
- } else {
6245
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6246
- }
6247
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6248
- {
6249
- if (isOn(key) && key.endsWith("Native")) {
6250
- key = key.slice(0, -6);
6251
- } else if (shouldSkipAttr(key, instance)) {
6252
- continue;
6253
- }
6254
- }
6255
- if (!(key in attrs) || value !== attrs[key]) {
6256
- attrs[key] = value;
6257
- hasAttrsChanged = true;
6258
- }
6259
- }
6156
+ Vue.extend = extendCtor.bind(Vue);
6157
+ Vue.set = (target, key, value) => {
6158
+ assertCompatEnabled("GLOBAL_SET", null);
6159
+ target[key] = value;
6160
+ };
6161
+ Vue.delete = (target, key) => {
6162
+ assertCompatEnabled("GLOBAL_DELETE", null);
6163
+ delete target[key];
6164
+ };
6165
+ Vue.observable = (target) => {
6166
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6167
+ return reactive(target);
6168
+ };
6169
+ Vue.filter = (name, filter) => {
6170
+ if (filter) {
6171
+ singletonApp.filter(name, filter);
6172
+ return Vue;
6173
+ } else {
6174
+ return singletonApp.filter(name);
6260
6175
  }
6261
- }
6262
- if (needCastKeys) {
6263
- const rawCurrentProps = toRaw(props);
6264
- const castValues = rawCastValues || EMPTY_OBJ;
6265
- for (let i = 0; i < needCastKeys.length; i++) {
6266
- const key = needCastKeys[i];
6267
- props[key] = resolvePropValue(
6268
- options,
6269
- rawCurrentProps,
6270
- key,
6271
- castValues[key],
6272
- instance,
6273
- !hasOwn(castValues, key)
6274
- );
6176
+ };
6177
+ const util = {
6178
+ warn: warn ,
6179
+ extend,
6180
+ mergeOptions: (parent, child, vm) => mergeOptions(
6181
+ parent,
6182
+ child,
6183
+ vm ? void 0 : internalOptionMergeStrats
6184
+ ),
6185
+ defineReactive
6186
+ };
6187
+ Object.defineProperty(Vue, "util", {
6188
+ get() {
6189
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6190
+ return util;
6275
6191
  }
6192
+ });
6193
+ Vue.configureCompat = configureCompat$1;
6194
+ return Vue;
6195
+ }
6196
+ function installAppCompatProperties(app, context, render) {
6197
+ installFilterMethod(app, context);
6198
+ installLegacyOptionMergeStrats(app.config);
6199
+ if (!singletonApp) {
6200
+ return;
6276
6201
  }
6277
- return hasAttrsChanged;
6202
+ installCompatMount(app, context, render);
6203
+ installLegacyAPIs(app);
6204
+ applySingletonAppMutations(app);
6205
+ installLegacyConfigWarnings(app.config);
6278
6206
  }
6279
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6280
- const opt = options[key];
6281
- if (opt != null) {
6282
- const hasDefault = hasOwn(opt, "default");
6283
- if (hasDefault && value === void 0) {
6284
- const defaultValue = opt.default;
6285
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6286
- const { propsDefaults } = instance;
6287
- if (key in propsDefaults) {
6288
- value = propsDefaults[key];
6289
- } else {
6290
- setCurrentInstance(instance);
6291
- value = propsDefaults[key] = defaultValue.call(
6292
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6293
- props
6294
- );
6295
- unsetCurrentInstance();
6296
- }
6297
- } else {
6298
- value = defaultValue;
6299
- }
6207
+ function installFilterMethod(app, context) {
6208
+ context.filters = {};
6209
+ app.filter = (name, filter) => {
6210
+ assertCompatEnabled("FILTERS", null);
6211
+ if (!filter) {
6212
+ return context.filters[name];
6300
6213
  }
6301
- if (opt[0 /* shouldCast */]) {
6302
- if (isAbsent && !hasDefault) {
6303
- value = false;
6304
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6305
- value = true;
6306
- }
6214
+ if (context.filters[name]) {
6215
+ warn(`Filter "${name}" has already been registered.`);
6307
6216
  }
6308
- }
6309
- return value;
6217
+ context.filters[name] = filter;
6218
+ return app;
6219
+ };
6310
6220
  }
6311
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6312
- const cache = appContext.propsCache;
6313
- const cached = cache.get(comp);
6314
- if (cached) {
6315
- return cached;
6316
- }
6317
- const raw = comp.props;
6318
- const normalized = {};
6319
- const needCastKeys = [];
6320
- let hasExtends = false;
6321
- if (!isFunction(comp)) {
6322
- const extendProps = (raw2) => {
6323
- if (isFunction(raw2)) {
6324
- raw2 = raw2.options;
6221
+ function installLegacyAPIs(app) {
6222
+ Object.defineProperties(app, {
6223
+ // so that app.use() can work with legacy plugins that extend prototypes
6224
+ prototype: {
6225
+ get() {
6226
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6227
+ return app.config.globalProperties;
6228
+ }
6229
+ },
6230
+ nextTick: { value: nextTick },
6231
+ extend: { value: singletonCtor.extend },
6232
+ set: { value: singletonCtor.set },
6233
+ delete: { value: singletonCtor.delete },
6234
+ observable: { value: singletonCtor.observable },
6235
+ util: {
6236
+ get() {
6237
+ return singletonCtor.util;
6325
6238
  }
6326
- hasExtends = true;
6327
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6328
- extend(normalized, props);
6329
- if (keys)
6330
- needCastKeys.push(...keys);
6331
- };
6332
- if (!asMixin && appContext.mixins.length) {
6333
- appContext.mixins.forEach(extendProps);
6334
6239
  }
6335
- if (comp.extends) {
6336
- extendProps(comp.extends);
6240
+ });
6241
+ }
6242
+ function applySingletonAppMutations(app) {
6243
+ app._context.mixins = [...singletonApp._context.mixins];
6244
+ ["components", "directives", "filters"].forEach((key) => {
6245
+ app._context[key] = Object.create(singletonApp._context[key]);
6246
+ });
6247
+ isCopyingConfig = true;
6248
+ for (const key in singletonApp.config) {
6249
+ if (key === "isNativeTag")
6250
+ continue;
6251
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6252
+ continue;
6337
6253
  }
6338
- if (comp.mixins) {
6339
- comp.mixins.forEach(extendProps);
6254
+ const val = singletonApp.config[key];
6255
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6256
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6257
+ app.config.compilerOptions.isCustomElement = (tag) => {
6258
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6259
+ };
6340
6260
  }
6341
6261
  }
6342
- if (!raw && !hasExtends) {
6343
- if (isObject(comp)) {
6344
- cache.set(comp, EMPTY_ARR);
6345
- }
6346
- return EMPTY_ARR;
6262
+ isCopyingConfig = false;
6263
+ applySingletonPrototype(app, singletonCtor);
6264
+ }
6265
+ function applySingletonPrototype(app, Ctor) {
6266
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6267
+ if (enabled) {
6268
+ app.config.globalProperties = Object.create(Ctor.prototype);
6347
6269
  }
6348
- if (isArray(raw)) {
6349
- for (let i = 0; i < raw.length; i++) {
6350
- if (!isString(raw[i])) {
6351
- warn(`props must be strings when using array syntax.`, raw[i]);
6352
- }
6353
- const normalizedKey = camelize(raw[i]);
6354
- if (validatePropName(normalizedKey)) {
6355
- normalized[normalizedKey] = EMPTY_OBJ;
6356
- }
6357
- }
6358
- } else if (raw) {
6359
- if (!isObject(raw)) {
6360
- warn(`invalid props options`, raw);
6361
- }
6362
- for (const key in raw) {
6363
- const normalizedKey = camelize(key);
6364
- if (validatePropName(normalizedKey)) {
6365
- const opt = raw[key];
6366
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6367
- if (prop) {
6368
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6369
- const stringIndex = getTypeIndex(String, prop.type);
6370
- prop[0 /* shouldCast */] = booleanIndex > -1;
6371
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6372
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6373
- needCastKeys.push(normalizedKey);
6374
- }
6375
- }
6270
+ let hasPrototypeAugmentations = false;
6271
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6272
+ for (const key in descriptors) {
6273
+ if (key !== "constructor") {
6274
+ hasPrototypeAugmentations = true;
6275
+ if (enabled) {
6276
+ Object.defineProperty(
6277
+ app.config.globalProperties,
6278
+ key,
6279
+ descriptors[key]
6280
+ );
6376
6281
  }
6377
6282
  }
6378
6283
  }
6379
- const res = [normalized, needCastKeys];
6380
- if (isObject(comp)) {
6381
- cache.set(comp, res);
6382
- }
6383
- return res;
6284
+ if (hasPrototypeAugmentations) {
6285
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6286
+ }
6384
6287
  }
6385
- function validatePropName(key) {
6386
- if (key[0] !== "$") {
6387
- return true;
6288
+ function installCompatMount(app, context, render) {
6289
+ let isMounted = false;
6290
+ app._createRoot = (options) => {
6291
+ const component = app._component;
6292
+ const vnode = createVNode(component, options.propsData || null);
6293
+ vnode.appContext = context;
6294
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6295
+ const emptyRender = () => {
6296
+ };
6297
+ const instance = createComponentInstance(vnode, null, null);
6298
+ if (hasNoRender) {
6299
+ instance.render = emptyRender;
6300
+ }
6301
+ setupComponent(instance);
6302
+ vnode.component = instance;
6303
+ vnode.isCompatRoot = true;
6304
+ instance.ctx._compat_mount = (selectorOrEl) => {
6305
+ if (isMounted) {
6306
+ warn(`Root instance is already mounted.`);
6307
+ return;
6308
+ }
6309
+ let container;
6310
+ if (typeof selectorOrEl === "string") {
6311
+ const result = document.querySelector(selectorOrEl);
6312
+ if (!result) {
6313
+ warn(
6314
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6315
+ );
6316
+ return;
6317
+ }
6318
+ container = result;
6319
+ } else {
6320
+ container = selectorOrEl || document.createElement("div");
6321
+ }
6322
+ const isSVG = container instanceof SVGElement;
6323
+ {
6324
+ context.reload = () => {
6325
+ const cloned = cloneVNode(vnode);
6326
+ cloned.component = null;
6327
+ render(cloned, container, isSVG);
6328
+ };
6329
+ }
6330
+ if (hasNoRender && instance.render === emptyRender) {
6331
+ {
6332
+ for (let i = 0; i < container.attributes.length; i++) {
6333
+ const attr = container.attributes[i];
6334
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6335
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6336
+ break;
6337
+ }
6338
+ }
6339
+ }
6340
+ instance.render = null;
6341
+ component.template = container.innerHTML;
6342
+ finishComponentSetup(
6343
+ instance,
6344
+ false,
6345
+ true
6346
+ /* skip options */
6347
+ );
6348
+ }
6349
+ container.innerHTML = "";
6350
+ render(vnode, container, isSVG);
6351
+ if (container instanceof Element) {
6352
+ container.removeAttribute("v-cloak");
6353
+ container.setAttribute("data-v-app", "");
6354
+ }
6355
+ isMounted = true;
6356
+ app._container = container;
6357
+ container.__vue_app__ = app;
6358
+ {
6359
+ devtoolsInitApp(app, version);
6360
+ }
6361
+ return instance.proxy;
6362
+ };
6363
+ instance.ctx._compat_destroy = () => {
6364
+ if (isMounted) {
6365
+ render(null, app._container);
6366
+ {
6367
+ devtoolsUnmountApp(app);
6368
+ }
6369
+ delete app._container.__vue_app__;
6370
+ } else {
6371
+ const { bum, scope, um } = instance;
6372
+ if (bum) {
6373
+ invokeArrayFns(bum);
6374
+ }
6375
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6376
+ instance.emit("hook:beforeDestroy");
6377
+ }
6378
+ if (scope) {
6379
+ scope.stop();
6380
+ }
6381
+ if (um) {
6382
+ invokeArrayFns(um);
6383
+ }
6384
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6385
+ instance.emit("hook:destroyed");
6386
+ }
6387
+ }
6388
+ };
6389
+ return instance.proxy;
6390
+ };
6391
+ }
6392
+ const methodsToPatch = [
6393
+ "push",
6394
+ "pop",
6395
+ "shift",
6396
+ "unshift",
6397
+ "splice",
6398
+ "sort",
6399
+ "reverse"
6400
+ ];
6401
+ const patched = /* @__PURE__ */ new WeakSet();
6402
+ function defineReactive(obj, key, val) {
6403
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6404
+ const reactiveVal = reactive(val);
6405
+ if (isArray(val)) {
6406
+ methodsToPatch.forEach((m) => {
6407
+ val[m] = (...args) => {
6408
+ Array.prototype[m].call(reactiveVal, ...args);
6409
+ };
6410
+ });
6411
+ } else {
6412
+ Object.keys(val).forEach((key2) => {
6413
+ try {
6414
+ defineReactiveSimple(val, key2, val[key2]);
6415
+ } catch (e) {
6416
+ }
6417
+ });
6418
+ }
6419
+ }
6420
+ const i = obj.$;
6421
+ if (i && obj === i.proxy) {
6422
+ defineReactiveSimple(i.ctx, key, val);
6423
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6424
+ } else if (isReactive(obj)) {
6425
+ obj[key] = val;
6388
6426
  } else {
6389
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6427
+ defineReactiveSimple(obj, key, val);
6390
6428
  }
6391
- return false;
6392
- }
6393
- function getType(ctor) {
6394
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6395
- return match ? match[2] : ctor === null ? "null" : "";
6396
6429
  }
6397
- function isSameType(a, b) {
6398
- return getType(a) === getType(b);
6430
+ function defineReactiveSimple(obj, key, val) {
6431
+ val = isObject(val) ? reactive(val) : val;
6432
+ Object.defineProperty(obj, key, {
6433
+ enumerable: true,
6434
+ configurable: true,
6435
+ get() {
6436
+ track(obj, "get", key);
6437
+ return val;
6438
+ },
6439
+ set(newVal) {
6440
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6441
+ trigger(obj, "set", key, newVal);
6442
+ }
6443
+ });
6399
6444
  }
6400
- function getTypeIndex(type, expectedTypes) {
6401
- if (isArray(expectedTypes)) {
6402
- return expectedTypes.findIndex((t) => isSameType(t, type));
6403
- } else if (isFunction(expectedTypes)) {
6404
- return isSameType(expectedTypes, type) ? 0 : -1;
6405
- }
6406
- return -1;
6445
+
6446
+ function createAppContext() {
6447
+ return {
6448
+ app: null,
6449
+ config: {
6450
+ isNativeTag: NO,
6451
+ performance: false,
6452
+ globalProperties: {},
6453
+ optionMergeStrategies: {},
6454
+ errorHandler: void 0,
6455
+ warnHandler: void 0,
6456
+ compilerOptions: {}
6457
+ },
6458
+ mixins: [],
6459
+ components: {},
6460
+ directives: {},
6461
+ provides: /* @__PURE__ */ Object.create(null),
6462
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6463
+ propsCache: /* @__PURE__ */ new WeakMap(),
6464
+ emitsCache: /* @__PURE__ */ new WeakMap()
6465
+ };
6407
6466
  }
6408
- function validateProps(rawProps, props, instance) {
6409
- const resolvedValues = toRaw(props);
6410
- const options = instance.propsOptions[0];
6411
- for (const key in options) {
6412
- let opt = options[key];
6413
- if (opt == null)
6414
- continue;
6415
- validateProp(
6416
- key,
6417
- resolvedValues[key],
6418
- opt,
6419
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6420
- );
6421
- }
6467
+ let uid$1 = 0;
6468
+ function createAppAPI(render, hydrate) {
6469
+ return function createApp(rootComponent, rootProps = null) {
6470
+ if (!isFunction(rootComponent)) {
6471
+ rootComponent = extend({}, rootComponent);
6472
+ }
6473
+ if (rootProps != null && !isObject(rootProps)) {
6474
+ warn(`root props passed to app.mount() must be an object.`);
6475
+ rootProps = null;
6476
+ }
6477
+ const context = createAppContext();
6478
+ const installedPlugins = /* @__PURE__ */ new Set();
6479
+ let isMounted = false;
6480
+ const app = context.app = {
6481
+ _uid: uid$1++,
6482
+ _component: rootComponent,
6483
+ _props: rootProps,
6484
+ _container: null,
6485
+ _context: context,
6486
+ _instance: null,
6487
+ version,
6488
+ get config() {
6489
+ return context.config;
6490
+ },
6491
+ set config(v) {
6492
+ {
6493
+ warn(
6494
+ `app.config cannot be replaced. Modify individual options instead.`
6495
+ );
6496
+ }
6497
+ },
6498
+ use(plugin, ...options) {
6499
+ if (installedPlugins.has(plugin)) {
6500
+ warn(`Plugin has already been applied to target app.`);
6501
+ } else if (plugin && isFunction(plugin.install)) {
6502
+ installedPlugins.add(plugin);
6503
+ plugin.install(app, ...options);
6504
+ } else if (isFunction(plugin)) {
6505
+ installedPlugins.add(plugin);
6506
+ plugin(app, ...options);
6507
+ } else {
6508
+ warn(
6509
+ `A plugin must either be a function or an object with an "install" function.`
6510
+ );
6511
+ }
6512
+ return app;
6513
+ },
6514
+ mixin(mixin) {
6515
+ {
6516
+ if (!context.mixins.includes(mixin)) {
6517
+ context.mixins.push(mixin);
6518
+ } else {
6519
+ warn(
6520
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6521
+ );
6522
+ }
6523
+ }
6524
+ return app;
6525
+ },
6526
+ component(name, component) {
6527
+ {
6528
+ validateComponentName(name, context.config);
6529
+ }
6530
+ if (!component) {
6531
+ return context.components[name];
6532
+ }
6533
+ if (context.components[name]) {
6534
+ warn(`Component "${name}" has already been registered in target app.`);
6535
+ }
6536
+ context.components[name] = component;
6537
+ return app;
6538
+ },
6539
+ directive(name, directive) {
6540
+ {
6541
+ validateDirectiveName(name);
6542
+ }
6543
+ if (!directive) {
6544
+ return context.directives[name];
6545
+ }
6546
+ if (context.directives[name]) {
6547
+ warn(`Directive "${name}" has already been registered in target app.`);
6548
+ }
6549
+ context.directives[name] = directive;
6550
+ return app;
6551
+ },
6552
+ mount(rootContainer, isHydrate, isSVG) {
6553
+ if (!isMounted) {
6554
+ if (rootContainer.__vue_app__) {
6555
+ warn(
6556
+ `There is already an app instance mounted on the host container.
6557
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6558
+ );
6559
+ }
6560
+ const vnode = createVNode(
6561
+ rootComponent,
6562
+ rootProps
6563
+ );
6564
+ vnode.appContext = context;
6565
+ {
6566
+ context.reload = () => {
6567
+ render(cloneVNode(vnode), rootContainer, isSVG);
6568
+ };
6569
+ }
6570
+ if (isHydrate && hydrate) {
6571
+ hydrate(vnode, rootContainer);
6572
+ } else {
6573
+ render(vnode, rootContainer, isSVG);
6574
+ }
6575
+ isMounted = true;
6576
+ app._container = rootContainer;
6577
+ rootContainer.__vue_app__ = app;
6578
+ {
6579
+ app._instance = vnode.component;
6580
+ devtoolsInitApp(app, version);
6581
+ }
6582
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6583
+ } else {
6584
+ warn(
6585
+ `App has already been mounted.
6586
+ If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
6587
+ );
6588
+ }
6589
+ },
6590
+ unmount() {
6591
+ if (isMounted) {
6592
+ render(null, app._container);
6593
+ {
6594
+ app._instance = null;
6595
+ devtoolsUnmountApp(app);
6596
+ }
6597
+ delete app._container.__vue_app__;
6598
+ } else {
6599
+ warn(`Cannot unmount an app that is not mounted.`);
6600
+ }
6601
+ },
6602
+ provide(key, value) {
6603
+ if (key in context.provides) {
6604
+ warn(
6605
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6606
+ );
6607
+ }
6608
+ context.provides[key] = value;
6609
+ return app;
6610
+ },
6611
+ runWithContext(fn) {
6612
+ currentApp = app;
6613
+ try {
6614
+ return fn();
6615
+ } finally {
6616
+ currentApp = null;
6617
+ }
6618
+ }
6619
+ };
6620
+ {
6621
+ installAppCompatProperties(app, context, render);
6622
+ }
6623
+ return app;
6624
+ };
6422
6625
  }
6423
- function validateProp(name, value, prop, isAbsent) {
6424
- const { type, required, validator, skipCheck } = prop;
6425
- if (required && isAbsent) {
6426
- warn('Missing required prop: "' + name + '"');
6427
- return;
6428
- }
6429
- if (value == null && !prop.required) {
6430
- return;
6431
- }
6432
- if (type != null && type !== true && !skipCheck) {
6433
- let isValid = false;
6434
- const types = isArray(type) ? type : [type];
6435
- const expectedTypes = [];
6436
- for (let i = 0; i < types.length && !isValid; i++) {
6437
- const { valid, expectedType } = assertType(value, types[i]);
6438
- expectedTypes.push(expectedType || "");
6439
- isValid = valid;
6626
+ let currentApp = null;
6627
+
6628
+ function provide(key, value) {
6629
+ if (!currentInstance) {
6630
+ {
6631
+ warn(`provide() can only be used inside setup().`);
6440
6632
  }
6441
- if (!isValid) {
6442
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6443
- return;
6633
+ } else {
6634
+ let provides = currentInstance.provides;
6635
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6636
+ if (parentProvides === provides) {
6637
+ provides = currentInstance.provides = Object.create(parentProvides);
6444
6638
  }
6445
- }
6446
- if (validator && !validator(value)) {
6447
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6639
+ provides[key] = value;
6448
6640
  }
6449
6641
  }
6450
- const isSimpleType = /* @__PURE__ */ makeMap(
6451
- "String,Number,Boolean,Function,Symbol,BigInt"
6452
- );
6453
- function assertType(value, type) {
6454
- let valid;
6455
- const expectedType = getType(type);
6456
- if (isSimpleType(expectedType)) {
6457
- const t = typeof value;
6458
- valid = t === expectedType.toLowerCase();
6459
- if (!valid && t === "object") {
6460
- valid = value instanceof type;
6642
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6643
+ const instance = currentInstance || currentRenderingInstance;
6644
+ if (instance || currentApp) {
6645
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6646
+ if (provides && key in provides) {
6647
+ return provides[key];
6648
+ } else if (arguments.length > 1) {
6649
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6650
+ } else {
6651
+ warn(`injection "${String(key)}" not found.`);
6461
6652
  }
6462
- } else if (expectedType === "Object") {
6463
- valid = isObject(value);
6464
- } else if (expectedType === "Array") {
6465
- valid = isArray(value);
6466
- } else if (expectedType === "null") {
6467
- valid = value === null;
6468
6653
  } else {
6469
- valid = value instanceof type;
6654
+ warn(`inject() can only be used inside setup() or functional components.`);
6470
6655
  }
6471
- return {
6472
- valid,
6473
- expectedType
6474
- };
6475
6656
  }
6476
- function getInvalidTypeMessage(name, value, expectedTypes) {
6477
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6478
- const expectedType = expectedTypes[0];
6479
- const receivedType = toRawType(value);
6480
- const expectedValue = styleValue(value, expectedType);
6481
- const receivedValue = styleValue(value, receivedType);
6482
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6483
- message += ` with value ${expectedValue}`;
6657
+
6658
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6659
+ return new Proxy(
6660
+ {},
6661
+ {
6662
+ get(_, key) {
6663
+ warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6664
+ if (key === "$options") {
6665
+ return resolveMergedOptions(instance);
6666
+ }
6667
+ if (key in rawProps) {
6668
+ return rawProps[key];
6669
+ }
6670
+ const injections = instance.type.inject;
6671
+ if (injections) {
6672
+ if (isArray(injections)) {
6673
+ if (injections.includes(key)) {
6674
+ return inject(key);
6675
+ }
6676
+ } else if (key in injections) {
6677
+ return inject(key);
6678
+ }
6679
+ }
6680
+ }
6681
+ }
6682
+ );
6683
+ }
6684
+
6685
+ function shouldSkipAttr(key, instance) {
6686
+ if (key === "is") {
6687
+ return true;
6484
6688
  }
6485
- message += `, got ${receivedType} `;
6486
- if (isExplicable(receivedType)) {
6487
- message += `with value ${receivedValue}.`;
6689
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6690
+ return true;
6488
6691
  }
6489
- return message;
6490
- }
6491
- function styleValue(value, type) {
6492
- if (type === "String") {
6493
- return `"${value}"`;
6494
- } else if (type === "Number") {
6495
- return `${Number(value)}`;
6496
- } else {
6497
- return `${value}`;
6692
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6693
+ return true;
6498
6694
  }
6499
- }
6500
- function isExplicable(type) {
6501
- const explicitTypes = ["string", "number", "boolean"];
6502
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6503
- }
6504
- function isBoolean(...args) {
6505
- return args.some((elem) => elem.toLowerCase() === "boolean");
6695
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6696
+ return true;
6697
+ }
6698
+ return false;
6506
6699
  }
6507
6700
 
6508
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6509
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6510
- const normalizeSlot = (key, rawSlot, ctx) => {
6511
- if (rawSlot._n) {
6512
- return rawSlot;
6513
- }
6514
- const normalized = withCtx((...args) => {
6515
- if (currentInstance) {
6516
- warn(
6517
- `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.`
6518
- );
6519
- }
6520
- return normalizeSlotValue(rawSlot(...args));
6521
- }, ctx);
6522
- normalized._c = false;
6523
- return normalized;
6524
- };
6525
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6526
- const ctx = rawSlots._ctx;
6527
- for (const key in rawSlots) {
6528
- if (isInternalKey(key))
6529
- continue;
6530
- const value = rawSlots[key];
6531
- if (isFunction(value)) {
6532
- slots[key] = normalizeSlot(key, value, ctx);
6533
- } else if (value != null) {
6534
- if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6535
- warn(
6536
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6537
- );
6538
- }
6539
- const normalized = normalizeSlotValue(value);
6540
- slots[key] = () => normalized;
6701
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6702
+ const props = {};
6703
+ const attrs = {};
6704
+ def(attrs, InternalObjectKey, 1);
6705
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6706
+ setFullProps(instance, rawProps, props, attrs);
6707
+ for (const key in instance.propsOptions[0]) {
6708
+ if (!(key in props)) {
6709
+ props[key] = void 0;
6541
6710
  }
6542
6711
  }
6543
- };
6544
- const normalizeVNodeSlots = (instance, children) => {
6545
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6546
- warn(
6547
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6548
- );
6712
+ {
6713
+ validateProps(rawProps || {}, props, instance);
6549
6714
  }
6550
- const normalized = normalizeSlotValue(children);
6551
- instance.slots.default = () => normalized;
6552
- };
6553
- const initSlots = (instance, children) => {
6554
- if (instance.vnode.shapeFlag & 32) {
6555
- const type = children._;
6556
- if (type) {
6557
- instance.slots = toRaw(children);
6558
- def(children, "_", type);
6715
+ if (isStateful) {
6716
+ instance.props = isSSR ? props : shallowReactive(props);
6717
+ } else {
6718
+ if (!instance.type.props) {
6719
+ instance.props = attrs;
6559
6720
  } else {
6560
- normalizeObjectSlots(
6561
- children,
6562
- instance.slots = {},
6563
- instance
6564
- );
6721
+ instance.props = props;
6722
+ }
6723
+ }
6724
+ instance.attrs = attrs;
6725
+ }
6726
+ function isInHmrContext(instance) {
6727
+ while (instance) {
6728
+ if (instance.type.__hmrId)
6729
+ return true;
6730
+ instance = instance.parent;
6731
+ }
6732
+ }
6733
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6734
+ const {
6735
+ props,
6736
+ attrs,
6737
+ vnode: { patchFlag }
6738
+ } = instance;
6739
+ const rawCurrentProps = toRaw(props);
6740
+ const [options] = instance.propsOptions;
6741
+ let hasAttrsChanged = false;
6742
+ if (
6743
+ // always force full diff in dev
6744
+ // - #1942 if hmr is enabled with sfc component
6745
+ // - vite#872 non-sfc component used by sfc component
6746
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6747
+ ) {
6748
+ if (patchFlag & 8) {
6749
+ const propsToUpdate = instance.vnode.dynamicProps;
6750
+ for (let i = 0; i < propsToUpdate.length; i++) {
6751
+ let key = propsToUpdate[i];
6752
+ if (isEmitListener(instance.emitsOptions, key)) {
6753
+ continue;
6754
+ }
6755
+ const value = rawProps[key];
6756
+ if (options) {
6757
+ if (hasOwn(attrs, key)) {
6758
+ if (value !== attrs[key]) {
6759
+ attrs[key] = value;
6760
+ hasAttrsChanged = true;
6761
+ }
6762
+ } else {
6763
+ const camelizedKey = camelize(key);
6764
+ props[camelizedKey] = resolvePropValue(
6765
+ options,
6766
+ rawCurrentProps,
6767
+ camelizedKey,
6768
+ value,
6769
+ instance,
6770
+ false
6771
+ /* isAbsent */
6772
+ );
6773
+ }
6774
+ } else {
6775
+ {
6776
+ if (isOn(key) && key.endsWith("Native")) {
6777
+ key = key.slice(0, -6);
6778
+ } else if (shouldSkipAttr(key, instance)) {
6779
+ continue;
6780
+ }
6781
+ }
6782
+ if (value !== attrs[key]) {
6783
+ attrs[key] = value;
6784
+ hasAttrsChanged = true;
6785
+ }
6786
+ }
6787
+ }
6565
6788
  }
6566
6789
  } else {
6567
- instance.slots = {};
6568
- if (children) {
6569
- normalizeVNodeSlots(instance, children);
6790
+ if (setFullProps(instance, rawProps, props, attrs)) {
6791
+ hasAttrsChanged = true;
6570
6792
  }
6571
- }
6572
- def(instance.slots, InternalObjectKey, 1);
6573
- };
6574
- const updateSlots = (instance, children, optimized) => {
6575
- const { vnode, slots } = instance;
6576
- let needDeletionCheck = true;
6577
- let deletionComparisonTarget = EMPTY_OBJ;
6578
- if (vnode.shapeFlag & 32) {
6579
- const type = children._;
6580
- if (type) {
6581
- if (isHmrUpdating) {
6582
- extend(slots, children);
6583
- } else if (optimized && type === 1) {
6584
- needDeletionCheck = false;
6585
- } else {
6586
- extend(slots, children);
6587
- if (!optimized && type === 1) {
6588
- delete slots._;
6793
+ let kebabKey;
6794
+ for (const key in rawCurrentProps) {
6795
+ if (!rawProps || // for camelCase
6796
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6797
+ // and converted to camelCase (#955)
6798
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6799
+ if (options) {
6800
+ if (rawPrevProps && // for camelCase
6801
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6802
+ rawPrevProps[kebabKey] !== void 0)) {
6803
+ props[key] = resolvePropValue(
6804
+ options,
6805
+ rawCurrentProps,
6806
+ key,
6807
+ void 0,
6808
+ instance,
6809
+ true
6810
+ /* isAbsent */
6811
+ );
6812
+ }
6813
+ } else {
6814
+ delete props[key];
6589
6815
  }
6590
6816
  }
6591
- } else {
6592
- needDeletionCheck = !children.$stable;
6593
- normalizeObjectSlots(children, slots, instance);
6594
6817
  }
6595
- deletionComparisonTarget = children;
6596
- } else if (children) {
6597
- normalizeVNodeSlots(instance, children);
6598
- deletionComparisonTarget = { default: 1 };
6599
- }
6600
- if (needDeletionCheck) {
6601
- for (const key in slots) {
6602
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6603
- delete slots[key];
6818
+ if (attrs !== rawCurrentProps) {
6819
+ for (const key in attrs) {
6820
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6821
+ delete attrs[key];
6822
+ hasAttrsChanged = true;
6823
+ }
6604
6824
  }
6605
6825
  }
6606
6826
  }
6607
- };
6608
-
6609
- function installLegacyConfigWarnings(config) {
6610
- const legacyConfigOptions = {
6611
- silent: "CONFIG_SILENT",
6612
- devtools: "CONFIG_DEVTOOLS",
6613
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6614
- keyCodes: "CONFIG_KEY_CODES",
6615
- productionTip: "CONFIG_PRODUCTION_TIP"
6616
- };
6617
- Object.keys(legacyConfigOptions).forEach((key) => {
6618
- let val = config[key];
6619
- Object.defineProperty(config, key, {
6620
- enumerable: true,
6621
- get() {
6622
- return val;
6623
- },
6624
- set(newVal) {
6625
- if (!isCopyingConfig) {
6626
- warnDeprecation$1(legacyConfigOptions[key], null);
6627
- }
6628
- val = newVal;
6629
- }
6630
- });
6631
- });
6827
+ if (hasAttrsChanged) {
6828
+ trigger(instance, "set", "$attrs");
6829
+ }
6830
+ {
6831
+ validateProps(rawProps || {}, props, instance);
6832
+ }
6632
6833
  }
6633
- function installLegacyOptionMergeStrats(config) {
6634
- config.optionMergeStrategies = new Proxy({}, {
6635
- get(target, key) {
6636
- if (key in target) {
6637
- return target[key];
6834
+ function setFullProps(instance, rawProps, props, attrs) {
6835
+ const [options, needCastKeys] = instance.propsOptions;
6836
+ let hasAttrsChanged = false;
6837
+ let rawCastValues;
6838
+ if (rawProps) {
6839
+ for (let key in rawProps) {
6840
+ if (isReservedProp(key)) {
6841
+ continue;
6638
6842
  }
6639
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6640
- "CONFIG_OPTION_MERGE_STRATS",
6641
- null
6642
- )) {
6643
- return internalOptionMergeStrats[key];
6843
+ {
6844
+ if (key.startsWith("onHook:")) {
6845
+ softAssertCompatEnabled(
6846
+ "INSTANCE_EVENT_HOOKS",
6847
+ instance,
6848
+ key.slice(2).toLowerCase()
6849
+ );
6850
+ }
6851
+ if (key === "inline-template") {
6852
+ continue;
6853
+ }
6854
+ }
6855
+ const value = rawProps[key];
6856
+ let camelKey;
6857
+ if (options && hasOwn(options, camelKey = camelize(key))) {
6858
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6859
+ props[camelKey] = value;
6860
+ } else {
6861
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6862
+ }
6863
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
6864
+ {
6865
+ if (isOn(key) && key.endsWith("Native")) {
6866
+ key = key.slice(0, -6);
6867
+ } else if (shouldSkipAttr(key, instance)) {
6868
+ continue;
6869
+ }
6870
+ }
6871
+ if (!(key in attrs) || value !== attrs[key]) {
6872
+ attrs[key] = value;
6873
+ hasAttrsChanged = true;
6874
+ }
6644
6875
  }
6645
- }
6646
- });
6647
- }
6648
-
6649
- let isCopyingConfig = false;
6650
- let singletonApp;
6651
- let singletonCtor;
6652
- function createCompatVue$1(createApp, createSingletonApp) {
6653
- singletonApp = createSingletonApp({});
6654
- const Vue = singletonCtor = function Vue2(options = {}) {
6655
- return createCompatApp(options, Vue2);
6656
- };
6657
- function createCompatApp(options = {}, Ctor) {
6658
- assertCompatEnabled("GLOBAL_MOUNT", null);
6659
- const { data } = options;
6660
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6661
- options.data = () => data;
6662
- }
6663
- const app = createApp(options);
6664
- if (Ctor !== Vue) {
6665
- applySingletonPrototype(app, Ctor);
6666
- }
6667
- const vm = app._createRoot(options);
6668
- if (options.el) {
6669
- return vm.$mount(options.el);
6670
- } else {
6671
- return vm;
6672
6876
  }
6673
6877
  }
6674
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6675
- Vue.config = singletonApp.config;
6676
- Vue.use = (p, ...options) => {
6677
- if (p && isFunction(p.install)) {
6678
- p.install(Vue, ...options);
6679
- } else if (isFunction(p)) {
6680
- p(Vue, ...options);
6681
- }
6682
- return Vue;
6683
- };
6684
- Vue.mixin = (m) => {
6685
- singletonApp.mixin(m);
6686
- return Vue;
6687
- };
6688
- Vue.component = (name, comp) => {
6689
- if (comp) {
6690
- singletonApp.component(name, comp);
6691
- return Vue;
6692
- } else {
6693
- return singletonApp.component(name);
6694
- }
6695
- };
6696
- Vue.directive = (name, dir) => {
6697
- if (dir) {
6698
- singletonApp.directive(name, dir);
6699
- return Vue;
6700
- } else {
6701
- return singletonApp.directive(name);
6702
- }
6703
- };
6704
- Vue.options = { _base: Vue };
6705
- let cid = 1;
6706
- Vue.cid = cid;
6707
- Vue.nextTick = nextTick;
6708
- const extendCache = /* @__PURE__ */ new WeakMap();
6709
- function extendCtor(extendOptions = {}) {
6710
- assertCompatEnabled("GLOBAL_EXTEND", null);
6711
- if (isFunction(extendOptions)) {
6712
- extendOptions = extendOptions.options;
6713
- }
6714
- if (extendCache.has(extendOptions)) {
6715
- return extendCache.get(extendOptions);
6878
+ if (needCastKeys) {
6879
+ const rawCurrentProps = toRaw(props);
6880
+ const castValues = rawCastValues || EMPTY_OBJ;
6881
+ for (let i = 0; i < needCastKeys.length; i++) {
6882
+ const key = needCastKeys[i];
6883
+ props[key] = resolvePropValue(
6884
+ options,
6885
+ rawCurrentProps,
6886
+ key,
6887
+ castValues[key],
6888
+ instance,
6889
+ !hasOwn(castValues, key)
6890
+ );
6716
6891
  }
6717
- const Super = this;
6718
- function SubVue(inlineOptions) {
6719
- if (!inlineOptions) {
6720
- return createCompatApp(SubVue.options, SubVue);
6892
+ }
6893
+ return hasAttrsChanged;
6894
+ }
6895
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6896
+ const opt = options[key];
6897
+ if (opt != null) {
6898
+ const hasDefault = hasOwn(opt, "default");
6899
+ if (hasDefault && value === void 0) {
6900
+ const defaultValue = opt.default;
6901
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6902
+ const { propsDefaults } = instance;
6903
+ if (key in propsDefaults) {
6904
+ value = propsDefaults[key];
6905
+ } else {
6906
+ setCurrentInstance(instance);
6907
+ value = propsDefaults[key] = defaultValue.call(
6908
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6909
+ props
6910
+ );
6911
+ unsetCurrentInstance();
6912
+ }
6721
6913
  } else {
6722
- return createCompatApp(
6723
- mergeOptions(
6724
- extend({}, SubVue.options),
6725
- inlineOptions,
6726
- internalOptionMergeStrats
6727
- ),
6728
- SubVue
6729
- );
6914
+ value = defaultValue;
6730
6915
  }
6731
6916
  }
6732
- SubVue.super = Super;
6733
- SubVue.prototype = Object.create(Vue.prototype);
6734
- SubVue.prototype.constructor = SubVue;
6735
- const mergeBase = {};
6736
- for (const key in Super.options) {
6737
- const superValue = Super.options[key];
6738
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6917
+ if (opt[0 /* shouldCast */]) {
6918
+ if (isAbsent && !hasDefault) {
6919
+ value = false;
6920
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6921
+ value = true;
6922
+ }
6739
6923
  }
6740
- SubVue.options = mergeOptions(
6741
- mergeBase,
6742
- extendOptions,
6743
- internalOptionMergeStrats
6744
- );
6745
- SubVue.options._base = SubVue;
6746
- SubVue.extend = extendCtor.bind(SubVue);
6747
- SubVue.mixin = Super.mixin;
6748
- SubVue.use = Super.use;
6749
- SubVue.cid = ++cid;
6750
- extendCache.set(extendOptions, SubVue);
6751
- return SubVue;
6752
6924
  }
6753
- Vue.extend = extendCtor.bind(Vue);
6754
- Vue.set = (target, key, value) => {
6755
- assertCompatEnabled("GLOBAL_SET", null);
6756
- target[key] = value;
6757
- };
6758
- Vue.delete = (target, key) => {
6759
- assertCompatEnabled("GLOBAL_DELETE", null);
6760
- delete target[key];
6761
- };
6762
- Vue.observable = (target) => {
6763
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6764
- return reactive(target);
6765
- };
6766
- Vue.filter = (name, filter) => {
6767
- if (filter) {
6768
- singletonApp.filter(name, filter);
6769
- return Vue;
6770
- } else {
6771
- return singletonApp.filter(name);
6772
- }
6773
- };
6774
- const util = {
6775
- warn: warn ,
6776
- extend,
6777
- mergeOptions: (parent, child, vm) => mergeOptions(
6778
- parent,
6779
- child,
6780
- vm ? void 0 : internalOptionMergeStrats
6781
- ),
6782
- defineReactive
6783
- };
6784
- Object.defineProperty(Vue, "util", {
6785
- get() {
6786
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6787
- return util;
6788
- }
6789
- });
6790
- Vue.configureCompat = configureCompat$1;
6791
- return Vue;
6925
+ return value;
6792
6926
  }
6793
- function installAppCompatProperties(app, context, render) {
6794
- installFilterMethod(app, context);
6795
- installLegacyOptionMergeStrats(app.config);
6796
- if (!singletonApp) {
6797
- return;
6927
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
6928
+ const cache = appContext.propsCache;
6929
+ const cached = cache.get(comp);
6930
+ if (cached) {
6931
+ return cached;
6798
6932
  }
6799
- installCompatMount(app, context, render);
6800
- installLegacyAPIs(app);
6801
- applySingletonAppMutations(app);
6802
- installLegacyConfigWarnings(app.config);
6803
- }
6804
- function installFilterMethod(app, context) {
6805
- context.filters = {};
6806
- app.filter = (name, filter) => {
6807
- assertCompatEnabled("FILTERS", null);
6808
- if (!filter) {
6809
- return context.filters[name];
6933
+ const raw = comp.props;
6934
+ const normalized = {};
6935
+ const needCastKeys = [];
6936
+ let hasExtends = false;
6937
+ if (!isFunction(comp)) {
6938
+ const extendProps = (raw2) => {
6939
+ if (isFunction(raw2)) {
6940
+ raw2 = raw2.options;
6941
+ }
6942
+ hasExtends = true;
6943
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6944
+ extend(normalized, props);
6945
+ if (keys)
6946
+ needCastKeys.push(...keys);
6947
+ };
6948
+ if (!asMixin && appContext.mixins.length) {
6949
+ appContext.mixins.forEach(extendProps);
6810
6950
  }
6811
- if (context.filters[name]) {
6812
- warn(`Filter "${name}" has already been registered.`);
6951
+ if (comp.extends) {
6952
+ extendProps(comp.extends);
6813
6953
  }
6814
- context.filters[name] = filter;
6815
- return app;
6816
- };
6817
- }
6818
- function installLegacyAPIs(app) {
6819
- Object.defineProperties(app, {
6820
- // so that app.use() can work with legacy plugins that extend prototypes
6821
- prototype: {
6822
- get() {
6823
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6824
- return app.config.globalProperties;
6954
+ if (comp.mixins) {
6955
+ comp.mixins.forEach(extendProps);
6956
+ }
6957
+ }
6958
+ if (!raw && !hasExtends) {
6959
+ if (isObject(comp)) {
6960
+ cache.set(comp, EMPTY_ARR);
6961
+ }
6962
+ return EMPTY_ARR;
6963
+ }
6964
+ if (isArray(raw)) {
6965
+ for (let i = 0; i < raw.length; i++) {
6966
+ if (!isString(raw[i])) {
6967
+ warn(`props must be strings when using array syntax.`, raw[i]);
6825
6968
  }
6826
- },
6827
- nextTick: { value: nextTick },
6828
- extend: { value: singletonCtor.extend },
6829
- set: { value: singletonCtor.set },
6830
- delete: { value: singletonCtor.delete },
6831
- observable: { value: singletonCtor.observable },
6832
- util: {
6833
- get() {
6834
- return singletonCtor.util;
6969
+ const normalizedKey = camelize(raw[i]);
6970
+ if (validatePropName(normalizedKey)) {
6971
+ normalized[normalizedKey] = EMPTY_OBJ;
6835
6972
  }
6836
6973
  }
6837
- });
6838
- }
6839
- function applySingletonAppMutations(app) {
6840
- app._context.mixins = [...singletonApp._context.mixins];
6841
- ["components", "directives", "filters"].forEach((key) => {
6842
- app._context[key] = Object.create(singletonApp._context[key]);
6843
- });
6844
- isCopyingConfig = true;
6845
- for (const key in singletonApp.config) {
6846
- if (key === "isNativeTag")
6847
- continue;
6848
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6849
- continue;
6974
+ } else if (raw) {
6975
+ if (!isObject(raw)) {
6976
+ warn(`invalid props options`, raw);
6850
6977
  }
6851
- const val = singletonApp.config[key];
6852
- app.config[key] = isObject(val) ? Object.create(val) : val;
6853
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6854
- app.config.compilerOptions.isCustomElement = (tag) => {
6855
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6856
- };
6978
+ for (const key in raw) {
6979
+ const normalizedKey = camelize(key);
6980
+ if (validatePropName(normalizedKey)) {
6981
+ const opt = raw[key];
6982
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6983
+ if (prop) {
6984
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
6985
+ const stringIndex = getTypeIndex(String, prop.type);
6986
+ prop[0 /* shouldCast */] = booleanIndex > -1;
6987
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6988
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
6989
+ needCastKeys.push(normalizedKey);
6990
+ }
6991
+ }
6992
+ }
6857
6993
  }
6858
6994
  }
6859
- isCopyingConfig = false;
6860
- applySingletonPrototype(app, singletonCtor);
6995
+ const res = [normalized, needCastKeys];
6996
+ if (isObject(comp)) {
6997
+ cache.set(comp, res);
6998
+ }
6999
+ return res;
6861
7000
  }
6862
- function applySingletonPrototype(app, Ctor) {
6863
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6864
- if (enabled) {
6865
- app.config.globalProperties = Object.create(Ctor.prototype);
7001
+ function validatePropName(key) {
7002
+ if (key[0] !== "$") {
7003
+ return true;
7004
+ } else {
7005
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
6866
7006
  }
6867
- let hasPrototypeAugmentations = false;
6868
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6869
- for (const key in descriptors) {
6870
- if (key !== "constructor") {
6871
- hasPrototypeAugmentations = true;
6872
- if (enabled) {
6873
- Object.defineProperty(
6874
- app.config.globalProperties,
6875
- key,
6876
- descriptors[key]
6877
- );
6878
- }
7007
+ return false;
7008
+ }
7009
+ function getType(ctor) {
7010
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7011
+ return match ? match[2] : ctor === null ? "null" : "";
7012
+ }
7013
+ function isSameType(a, b) {
7014
+ return getType(a) === getType(b);
7015
+ }
7016
+ function getTypeIndex(type, expectedTypes) {
7017
+ if (isArray(expectedTypes)) {
7018
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7019
+ } else if (isFunction(expectedTypes)) {
7020
+ return isSameType(expectedTypes, type) ? 0 : -1;
7021
+ }
7022
+ return -1;
7023
+ }
7024
+ function validateProps(rawProps, props, instance) {
7025
+ const resolvedValues = toRaw(props);
7026
+ const options = instance.propsOptions[0];
7027
+ for (const key in options) {
7028
+ let opt = options[key];
7029
+ if (opt == null)
7030
+ continue;
7031
+ validateProp(
7032
+ key,
7033
+ resolvedValues[key],
7034
+ opt,
7035
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
7036
+ );
7037
+ }
7038
+ }
7039
+ function validateProp(name, value, prop, isAbsent) {
7040
+ const { type, required, validator, skipCheck } = prop;
7041
+ if (required && isAbsent) {
7042
+ warn('Missing required prop: "' + name + '"');
7043
+ return;
7044
+ }
7045
+ if (value == null && !required) {
7046
+ return;
7047
+ }
7048
+ if (type != null && type !== true && !skipCheck) {
7049
+ let isValid = false;
7050
+ const types = isArray(type) ? type : [type];
7051
+ const expectedTypes = [];
7052
+ for (let i = 0; i < types.length && !isValid; i++) {
7053
+ const { valid, expectedType } = assertType(value, types[i]);
7054
+ expectedTypes.push(expectedType || "");
7055
+ isValid = valid;
7056
+ }
7057
+ if (!isValid) {
7058
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7059
+ return;
6879
7060
  }
6880
7061
  }
6881
- if (hasPrototypeAugmentations) {
6882
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
7062
+ if (validator && !validator(value)) {
7063
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6883
7064
  }
6884
7065
  }
6885
- function installCompatMount(app, context, render) {
6886
- let isMounted = false;
6887
- app._createRoot = (options) => {
6888
- const component = app._component;
6889
- const vnode = createVNode(component, options.propsData || null);
6890
- vnode.appContext = context;
6891
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6892
- const emptyRender = () => {
6893
- };
6894
- const instance = createComponentInstance(vnode, null, null);
6895
- if (hasNoRender) {
6896
- instance.render = emptyRender;
7066
+ const isSimpleType = /* @__PURE__ */ makeMap(
7067
+ "String,Number,Boolean,Function,Symbol,BigInt"
7068
+ );
7069
+ function assertType(value, type) {
7070
+ let valid;
7071
+ const expectedType = getType(type);
7072
+ if (isSimpleType(expectedType)) {
7073
+ const t = typeof value;
7074
+ valid = t === expectedType.toLowerCase();
7075
+ if (!valid && t === "object") {
7076
+ valid = value instanceof type;
6897
7077
  }
6898
- setupComponent(instance);
6899
- vnode.component = instance;
6900
- vnode.isCompatRoot = true;
6901
- instance.ctx._compat_mount = (selectorOrEl) => {
6902
- if (isMounted) {
6903
- warn(`Root instance is already mounted.`);
6904
- return;
6905
- }
6906
- let container;
6907
- if (typeof selectorOrEl === "string") {
6908
- const result = document.querySelector(selectorOrEl);
6909
- if (!result) {
6910
- warn(
6911
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6912
- );
6913
- return;
6914
- }
6915
- container = result;
6916
- } else {
6917
- container = selectorOrEl || document.createElement("div");
6918
- }
6919
- const isSVG = container instanceof SVGElement;
6920
- {
6921
- context.reload = () => {
6922
- const cloned = cloneVNode(vnode);
6923
- cloned.component = null;
6924
- render(cloned, container, isSVG);
6925
- };
6926
- }
6927
- if (hasNoRender && instance.render === emptyRender) {
6928
- {
6929
- for (let i = 0; i < container.attributes.length; i++) {
6930
- const attr = container.attributes[i];
6931
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6932
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6933
- break;
6934
- }
6935
- }
6936
- }
6937
- instance.render = null;
6938
- component.template = container.innerHTML;
6939
- finishComponentSetup(
6940
- instance,
6941
- false,
6942
- true
6943
- /* skip options */
6944
- );
6945
- }
6946
- container.innerHTML = "";
6947
- render(vnode, container, isSVG);
6948
- if (container instanceof Element) {
6949
- container.removeAttribute("v-cloak");
6950
- container.setAttribute("data-v-app", "");
6951
- }
6952
- isMounted = true;
6953
- app._container = container;
6954
- container.__vue_app__ = app;
6955
- {
6956
- devtoolsInitApp(app, version);
6957
- }
6958
- return instance.proxy;
6959
- };
6960
- instance.ctx._compat_destroy = () => {
6961
- if (isMounted) {
6962
- render(null, app._container);
6963
- {
6964
- devtoolsUnmountApp(app);
6965
- }
6966
- delete app._container.__vue_app__;
6967
- } else {
6968
- const { bum, scope, um } = instance;
6969
- if (bum) {
6970
- invokeArrayFns(bum);
6971
- }
6972
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6973
- instance.emit("hook:beforeDestroy");
6974
- }
6975
- if (scope) {
6976
- scope.stop();
6977
- }
6978
- if (um) {
6979
- invokeArrayFns(um);
6980
- }
6981
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6982
- instance.emit("hook:destroyed");
6983
- }
6984
- }
6985
- };
6986
- return instance.proxy;
7078
+ } else if (expectedType === "Object") {
7079
+ valid = isObject(value);
7080
+ } else if (expectedType === "Array") {
7081
+ valid = isArray(value);
7082
+ } else if (expectedType === "null") {
7083
+ valid = value === null;
7084
+ } else {
7085
+ valid = value instanceof type;
7086
+ }
7087
+ return {
7088
+ valid,
7089
+ expectedType
6987
7090
  };
6988
7091
  }
6989
- const methodsToPatch = [
6990
- "push",
6991
- "pop",
6992
- "shift",
6993
- "unshift",
6994
- "splice",
6995
- "sort",
6996
- "reverse"
6997
- ];
6998
- const patched = /* @__PURE__ */ new WeakSet();
6999
- function defineReactive(obj, key, val) {
7000
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7001
- const reactiveVal = reactive(val);
7002
- if (isArray(val)) {
7003
- methodsToPatch.forEach((m) => {
7004
- val[m] = (...args) => {
7005
- Array.prototype[m].call(reactiveVal, ...args);
7006
- };
7007
- });
7008
- } else {
7009
- Object.keys(val).forEach((key2) => {
7010
- try {
7011
- defineReactiveSimple(val, key2, val[key2]);
7012
- } catch (e) {
7013
- }
7014
- });
7015
- }
7092
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7093
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7094
+ const expectedType = expectedTypes[0];
7095
+ const receivedType = toRawType(value);
7096
+ const expectedValue = styleValue(value, expectedType);
7097
+ const receivedValue = styleValue(value, receivedType);
7098
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7099
+ message += ` with value ${expectedValue}`;
7016
7100
  }
7017
- const i = obj.$;
7018
- if (i && obj === i.proxy) {
7019
- defineReactiveSimple(i.ctx, key, val);
7020
- i.accessCache = /* @__PURE__ */ Object.create(null);
7021
- } else if (isReactive(obj)) {
7022
- obj[key] = val;
7101
+ message += `, got ${receivedType} `;
7102
+ if (isExplicable(receivedType)) {
7103
+ message += `with value ${receivedValue}.`;
7104
+ }
7105
+ return message;
7106
+ }
7107
+ function styleValue(value, type) {
7108
+ if (type === "String") {
7109
+ return `"${value}"`;
7110
+ } else if (type === "Number") {
7111
+ return `${Number(value)}`;
7023
7112
  } else {
7024
- defineReactiveSimple(obj, key, val);
7113
+ return `${value}`;
7025
7114
  }
7026
7115
  }
7027
- function defineReactiveSimple(obj, key, val) {
7028
- val = isObject(val) ? reactive(val) : val;
7029
- Object.defineProperty(obj, key, {
7030
- enumerable: true,
7031
- configurable: true,
7032
- get() {
7033
- track(obj, "get", key);
7034
- return val;
7035
- },
7036
- set(newVal) {
7037
- val = isObject(newVal) ? reactive(newVal) : newVal;
7038
- trigger(obj, "set", key, newVal);
7116
+ function isExplicable(type) {
7117
+ const explicitTypes = ["string", "number", "boolean"];
7118
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7119
+ }
7120
+ function isBoolean(...args) {
7121
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7122
+ }
7123
+
7124
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7125
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7126
+ const normalizeSlot = (key, rawSlot, ctx) => {
7127
+ if (rawSlot._n) {
7128
+ return rawSlot;
7129
+ }
7130
+ const normalized = withCtx((...args) => {
7131
+ if (currentInstance) {
7132
+ warn(
7133
+ `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.`
7134
+ );
7135
+ }
7136
+ return normalizeSlotValue(rawSlot(...args));
7137
+ }, ctx);
7138
+ normalized._c = false;
7139
+ return normalized;
7140
+ };
7141
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7142
+ const ctx = rawSlots._ctx;
7143
+ for (const key in rawSlots) {
7144
+ if (isInternalKey(key))
7145
+ continue;
7146
+ const value = rawSlots[key];
7147
+ if (isFunction(value)) {
7148
+ slots[key] = normalizeSlot(key, value, ctx);
7149
+ } else if (value != null) {
7150
+ if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7151
+ warn(
7152
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7153
+ );
7154
+ }
7155
+ const normalized = normalizeSlotValue(value);
7156
+ slots[key] = () => normalized;
7039
7157
  }
7040
- });
7041
- }
7042
-
7043
- function createAppContext() {
7044
- return {
7045
- app: null,
7046
- config: {
7047
- isNativeTag: NO,
7048
- performance: false,
7049
- globalProperties: {},
7050
- optionMergeStrategies: {},
7051
- errorHandler: void 0,
7052
- warnHandler: void 0,
7053
- compilerOptions: {}
7054
- },
7055
- mixins: [],
7056
- components: {},
7057
- directives: {},
7058
- provides: /* @__PURE__ */ Object.create(null),
7059
- optionsCache: /* @__PURE__ */ new WeakMap(),
7060
- propsCache: /* @__PURE__ */ new WeakMap(),
7061
- emitsCache: /* @__PURE__ */ new WeakMap()
7062
- };
7063
- }
7064
- let uid$1 = 0;
7065
- function createAppAPI(render, hydrate) {
7066
- return function createApp(rootComponent, rootProps = null) {
7067
- if (!isFunction(rootComponent)) {
7068
- rootComponent = extend({}, rootComponent);
7158
+ }
7159
+ };
7160
+ const normalizeVNodeSlots = (instance, children) => {
7161
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7162
+ warn(
7163
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7164
+ );
7165
+ }
7166
+ const normalized = normalizeSlotValue(children);
7167
+ instance.slots.default = () => normalized;
7168
+ };
7169
+ const initSlots = (instance, children) => {
7170
+ if (instance.vnode.shapeFlag & 32) {
7171
+ const type = children._;
7172
+ if (type) {
7173
+ instance.slots = toRaw(children);
7174
+ def(children, "_", type);
7175
+ } else {
7176
+ normalizeObjectSlots(
7177
+ children,
7178
+ instance.slots = {},
7179
+ instance
7180
+ );
7069
7181
  }
7070
- if (rootProps != null && !isObject(rootProps)) {
7071
- warn(`root props passed to app.mount() must be an object.`);
7072
- rootProps = null;
7182
+ } else {
7183
+ instance.slots = {};
7184
+ if (children) {
7185
+ normalizeVNodeSlots(instance, children);
7073
7186
  }
7074
- const context = createAppContext();
7075
- const installedPlugins = /* @__PURE__ */ new Set();
7076
- let isMounted = false;
7077
- const app = context.app = {
7078
- _uid: uid$1++,
7079
- _component: rootComponent,
7080
- _props: rootProps,
7081
- _container: null,
7082
- _context: context,
7083
- _instance: null,
7084
- version,
7085
- get config() {
7086
- return context.config;
7087
- },
7088
- set config(v) {
7089
- {
7090
- warn(
7091
- `app.config cannot be replaced. Modify individual options instead.`
7092
- );
7093
- }
7094
- },
7095
- use(plugin, ...options) {
7096
- if (installedPlugins.has(plugin)) {
7097
- warn(`Plugin has already been applied to target app.`);
7098
- } else if (plugin && isFunction(plugin.install)) {
7099
- installedPlugins.add(plugin);
7100
- plugin.install(app, ...options);
7101
- } else if (isFunction(plugin)) {
7102
- installedPlugins.add(plugin);
7103
- plugin(app, ...options);
7104
- } else {
7105
- warn(
7106
- `A plugin must either be a function or an object with an "install" function.`
7107
- );
7108
- }
7109
- return app;
7110
- },
7111
- mixin(mixin) {
7112
- {
7113
- if (!context.mixins.includes(mixin)) {
7114
- context.mixins.push(mixin);
7115
- } else {
7116
- warn(
7117
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7118
- );
7119
- }
7120
- }
7121
- return app;
7122
- },
7123
- component(name, component) {
7124
- {
7125
- validateComponentName(name, context.config);
7126
- }
7127
- if (!component) {
7128
- return context.components[name];
7129
- }
7130
- if (context.components[name]) {
7131
- warn(`Component "${name}" has already been registered in target app.`);
7132
- }
7133
- context.components[name] = component;
7134
- return app;
7135
- },
7136
- directive(name, directive) {
7137
- {
7138
- validateDirectiveName(name);
7139
- }
7140
- if (!directive) {
7141
- return context.directives[name];
7142
- }
7143
- if (context.directives[name]) {
7144
- warn(`Directive "${name}" has already been registered in target app.`);
7145
- }
7146
- context.directives[name] = directive;
7147
- return app;
7148
- },
7149
- mount(rootContainer, isHydrate, isSVG) {
7150
- if (!isMounted) {
7151
- if (rootContainer.__vue_app__) {
7152
- warn(
7153
- `There is already an app instance mounted on the host container.
7154
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7155
- );
7156
- }
7157
- const vnode = createVNode(
7158
- rootComponent,
7159
- rootProps
7160
- );
7161
- vnode.appContext = context;
7162
- {
7163
- context.reload = () => {
7164
- render(cloneVNode(vnode), rootContainer, isSVG);
7165
- };
7166
- }
7167
- if (isHydrate && hydrate) {
7168
- hydrate(vnode, rootContainer);
7169
- } else {
7170
- render(vnode, rootContainer, isSVG);
7171
- }
7172
- isMounted = true;
7173
- app._container = rootContainer;
7174
- rootContainer.__vue_app__ = app;
7175
- {
7176
- app._instance = vnode.component;
7177
- devtoolsInitApp(app, version);
7178
- }
7179
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7180
- } else {
7181
- warn(
7182
- `App has already been mounted.
7183
- If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
7184
- );
7185
- }
7186
- },
7187
- unmount() {
7188
- if (isMounted) {
7189
- render(null, app._container);
7190
- {
7191
- app._instance = null;
7192
- devtoolsUnmountApp(app);
7193
- }
7194
- delete app._container.__vue_app__;
7195
- } else {
7196
- warn(`Cannot unmount an app that is not mounted.`);
7197
- }
7198
- },
7199
- provide(key, value) {
7200
- if (key in context.provides) {
7201
- warn(
7202
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7203
- );
7187
+ }
7188
+ def(instance.slots, InternalObjectKey, 1);
7189
+ };
7190
+ const updateSlots = (instance, children, optimized) => {
7191
+ const { vnode, slots } = instance;
7192
+ let needDeletionCheck = true;
7193
+ let deletionComparisonTarget = EMPTY_OBJ;
7194
+ if (vnode.shapeFlag & 32) {
7195
+ const type = children._;
7196
+ if (type) {
7197
+ if (isHmrUpdating) {
7198
+ extend(slots, children);
7199
+ } else if (optimized && type === 1) {
7200
+ needDeletionCheck = false;
7201
+ } else {
7202
+ extend(slots, children);
7203
+ if (!optimized && type === 1) {
7204
+ delete slots._;
7204
7205
  }
7205
- context.provides[key] = value;
7206
- return app;
7207
7206
  }
7208
- };
7209
- {
7210
- installAppCompatProperties(app, context, render);
7207
+ } else {
7208
+ needDeletionCheck = !children.$stable;
7209
+ normalizeObjectSlots(children, slots, instance);
7211
7210
  }
7212
- return app;
7213
- };
7214
- }
7211
+ deletionComparisonTarget = children;
7212
+ } else if (children) {
7213
+ normalizeVNodeSlots(instance, children);
7214
+ deletionComparisonTarget = { default: 1 };
7215
+ }
7216
+ if (needDeletionCheck) {
7217
+ for (const key in slots) {
7218
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7219
+ delete slots[key];
7220
+ }
7221
+ }
7222
+ }
7223
+ };
7215
7224
 
7216
7225
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7217
7226
  if (isArray(rawRef)) {
@@ -10373,6 +10382,12 @@ function defineSlots() {
10373
10382
  {
10374
10383
  warnRuntimeUsage(`defineSlots`);
10375
10384
  }
10385
+ return null;
10386
+ }
10387
+ function defineModel() {
10388
+ {
10389
+ warnRuntimeUsage("defineModel");
10390
+ }
10376
10391
  }
10377
10392
  function withDefaults(props, defaults) {
10378
10393
  {
@@ -10386,6 +10401,40 @@ function useSlots() {
10386
10401
  function useAttrs() {
10387
10402
  return getContext().attrs;
10388
10403
  }
10404
+ function useModel(props, name, options) {
10405
+ const i = getCurrentInstance();
10406
+ if (!i) {
10407
+ warn(`useModel() called without active instance.`);
10408
+ return ref();
10409
+ }
10410
+ if (!i.propsOptions[0][name]) {
10411
+ warn(`useModel() called with prop "${name}" which is not declared.`);
10412
+ return ref();
10413
+ }
10414
+ if (options && options.local) {
10415
+ const proxy = ref(props[name]);
10416
+ watch(
10417
+ () => props[name],
10418
+ (v) => proxy.value = v
10419
+ );
10420
+ watch(proxy, (value) => {
10421
+ if (value !== props[name]) {
10422
+ i.emit(`update:${name}`, value);
10423
+ }
10424
+ });
10425
+ return proxy;
10426
+ } else {
10427
+ return {
10428
+ __v_isRef: true,
10429
+ get value() {
10430
+ return props[name];
10431
+ },
10432
+ set value(value) {
10433
+ i.emit(`update:${name}`, value);
10434
+ }
10435
+ };
10436
+ }
10437
+ }
10389
10438
  function getContext() {
10390
10439
  const i = getCurrentInstance();
10391
10440
  if (!i) {
@@ -10393,11 +10442,14 @@ function getContext() {
10393
10442
  }
10394
10443
  return i.setupContext || (i.setupContext = createSetupContext(i));
10395
10444
  }
10396
- function mergeDefaults(raw, defaults) {
10397
- const props = isArray(raw) ? raw.reduce(
10445
+ function normalizePropsOrEmits(props) {
10446
+ return isArray(props) ? props.reduce(
10398
10447
  (normalized, p) => (normalized[p] = {}, normalized),
10399
10448
  {}
10400
- ) : raw;
10449
+ ) : props;
10450
+ }
10451
+ function mergeDefaults(raw, defaults) {
10452
+ const props = normalizePropsOrEmits(raw);
10401
10453
  for (const key in defaults) {
10402
10454
  if (key.startsWith("__skip"))
10403
10455
  continue;
@@ -10419,6 +10471,13 @@ function mergeDefaults(raw, defaults) {
10419
10471
  }
10420
10472
  return props;
10421
10473
  }
10474
+ function mergeModels(a, b) {
10475
+ if (!a || !b)
10476
+ return a || b;
10477
+ if (isArray(a) && isArray(b))
10478
+ return a.concat(b);
10479
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
10480
+ }
10422
10481
  function createPropsRestProxy(props, excludedKeys) {
10423
10482
  const ret = {};
10424
10483
  for (const key in props) {
@@ -10684,7 +10743,7 @@ function isMemoSame(cached, memo) {
10684
10743
  return true;
10685
10744
  }
10686
10745
 
10687
- const version = "3.3.0-alpha.7";
10746
+ const version = "3.3.0-alpha.9";
10688
10747
  const ssrUtils = null;
10689
10748
  const resolveFilter = resolveFilter$1 ;
10690
10749
  const _compatUtils = {
@@ -12340,6 +12399,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12340
12399
  defineCustomElement: defineCustomElement,
12341
12400
  defineEmits: defineEmits,
12342
12401
  defineExpose: defineExpose,
12402
+ defineModel: defineModel,
12343
12403
  defineOptions: defineOptions,
12344
12404
  defineProps: defineProps,
12345
12405
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12367,6 +12427,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12367
12427
  isVNode: isVNode,
12368
12428
  markRaw: markRaw,
12369
12429
  mergeDefaults: mergeDefaults,
12430
+ mergeModels: mergeModels,
12370
12431
  mergeProps: mergeProps,
12371
12432
  nextTick: nextTick,
12372
12433
  normalizeClass: normalizeClass,
@@ -12425,6 +12486,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12425
12486
  useAttrs: useAttrs,
12426
12487
  useCssModule: useCssModule,
12427
12488
  useCssVars: useCssVars,
12489
+ useModel: useModel,
12428
12490
  useSSRContext: useSSRContext,
12429
12491
  useSlots: useSlots,
12430
12492
  useTransitionState: useTransitionState,
@@ -16620,7 +16682,7 @@ const transformText = (node, context) => {
16620
16682
  const seen$1 = /* @__PURE__ */ new WeakSet();
16621
16683
  const transformOnce = (node, context) => {
16622
16684
  if (node.type === 1 && findDir(node, "once", true)) {
16623
- if (seen$1.has(node) || context.inVOnce) {
16685
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16624
16686
  return;
16625
16687
  }
16626
16688
  seen$1.add(node);
@@ -17475,4 +17537,4 @@ var Vue$1 = Vue;
17475
17537
 
17476
17538
  const { configureCompat } = Vue$1;
17477
17539
 
17478
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
17540
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };