@vue/compat 3.4.0-alpha.1 → 3.4.0-alpha.2

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.
@@ -2,12 +2,8 @@ var Vue = (function () {
2
2
  'use strict';
3
3
 
4
4
  function makeMap(str, expectsLowerCase) {
5
- const map = /* @__PURE__ */ Object.create(null);
6
- const list = str.split(",");
7
- for (let i = 0; i < list.length; i++) {
8
- map[list[i]] = true;
9
- }
10
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
5
+ const set = new Set(str.split(","));
6
+ return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
11
7
  }
12
8
 
13
9
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -107,7 +103,7 @@ var Vue = (function () {
107
103
  [4]: `STYLE`,
108
104
  [8]: `PROPS`,
109
105
  [16]: `FULL_PROPS`,
110
- [32]: `HYDRATE_EVENTS`,
106
+ [32]: `NEED_HYDRATION`,
111
107
  [64]: `STABLE_FRAGMENT`,
112
108
  [128]: `KEYED_FRAGMENT`,
113
109
  [256]: `UNKEYED_FRAGMENT`,
@@ -1029,7 +1025,7 @@ var Vue = (function () {
1029
1025
  toRaw(this)
1030
1026
  );
1031
1027
  }
1032
- return type === "delete" ? false : this;
1028
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1033
1029
  };
1034
1030
  }
1035
1031
  function createInstrumentations() {
@@ -1285,9 +1281,10 @@ var Vue = (function () {
1285
1281
  this.dep = void 0;
1286
1282
  this.__v_isRef = true;
1287
1283
  this["__v_isReadonly"] = false;
1288
- this.effect = new ReactiveEffect(getter, () => {
1289
- triggerRefValue(this, 1);
1290
- });
1284
+ this.effect = new ReactiveEffect(
1285
+ () => getter(this._value),
1286
+ () => triggerRefValue(this, 1)
1287
+ );
1291
1288
  this.effect.computed = this;
1292
1289
  this.effect.active = this._cacheable = !isSSR;
1293
1290
  this["__v_isReadonly"] = isReadonly;
@@ -1504,16 +1501,16 @@ var Vue = (function () {
1504
1501
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1505
1502
  }
1506
1503
 
1507
- const stack = [];
1504
+ const stack$1 = [];
1508
1505
  function pushWarningContext(vnode) {
1509
- stack.push(vnode);
1506
+ stack$1.push(vnode);
1510
1507
  }
1511
1508
  function popWarningContext() {
1512
- stack.pop();
1509
+ stack$1.pop();
1513
1510
  }
1514
1511
  function warn(msg, ...args) {
1515
1512
  pauseTracking();
1516
- const instance = stack.length ? stack[stack.length - 1].component : null;
1513
+ const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1517
1514
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
1518
1515
  const trace = getComponentTrace();
1519
1516
  if (appWarnHandler) {
@@ -1542,7 +1539,7 @@ var Vue = (function () {
1542
1539
  resetTracking();
1543
1540
  }
1544
1541
  function getComponentTrace() {
1545
- let currentVNode = stack[stack.length - 1];
1542
+ let currentVNode = stack$1[stack$1.length - 1];
1546
1543
  if (!currentVNode) {
1547
1544
  return [];
1548
1545
  }
@@ -2771,9 +2768,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2771
2768
  try {
2772
2769
  if (vnode.shapeFlag & 4) {
2773
2770
  const proxyToUse = withProxy || proxy;
2771
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2772
+ get(target, key, receiver) {
2773
+ warn(
2774
+ `Property '${String(
2775
+ key
2776
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2777
+ );
2778
+ return Reflect.get(target, key, receiver);
2779
+ }
2780
+ }) : proxyToUse;
2774
2781
  result = normalizeVNode(
2775
2782
  render.call(
2776
- proxyToUse,
2783
+ thisProxy,
2777
2784
  proxyToUse,
2778
2785
  renderCache,
2779
2786
  props,
@@ -3024,6 +3031,65 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3024
3031
  }
3025
3032
  }
3026
3033
 
3034
+ const COMPONENTS = "components";
3035
+ const DIRECTIVES = "directives";
3036
+ const FILTERS = "filters";
3037
+ function resolveComponent(name, maybeSelfReference) {
3038
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3039
+ }
3040
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3041
+ function resolveDynamicComponent(component) {
3042
+ if (isString(component)) {
3043
+ return resolveAsset(COMPONENTS, component, false) || component;
3044
+ } else {
3045
+ return component || NULL_DYNAMIC_COMPONENT;
3046
+ }
3047
+ }
3048
+ function resolveDirective(name) {
3049
+ return resolveAsset(DIRECTIVES, name);
3050
+ }
3051
+ function resolveFilter$1(name) {
3052
+ return resolveAsset(FILTERS, name);
3053
+ }
3054
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3055
+ const instance = currentRenderingInstance || currentInstance;
3056
+ if (instance) {
3057
+ const Component = instance.type;
3058
+ if (type === COMPONENTS) {
3059
+ const selfName = getComponentName(
3060
+ Component,
3061
+ false
3062
+ /* do not include inferred name to avoid breaking existing code */
3063
+ );
3064
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3065
+ return Component;
3066
+ }
3067
+ }
3068
+ const res = (
3069
+ // local registration
3070
+ // check instance[type] first which is resolved for options API
3071
+ resolve(instance[type] || Component[type], name) || // global registration
3072
+ resolve(instance.appContext[type], name)
3073
+ );
3074
+ if (!res && maybeSelfReference) {
3075
+ return Component;
3076
+ }
3077
+ if (warnMissing && !res) {
3078
+ const extra = type === COMPONENTS ? `
3079
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3080
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3081
+ }
3082
+ return res;
3083
+ } else {
3084
+ warn(
3085
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3086
+ );
3087
+ }
3088
+ }
3089
+ function resolve(registry, name) {
3090
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3091
+ }
3092
+
3027
3093
  const isSuspense = (type) => type.__isSuspense;
3028
3094
  const SuspenseImpl = {
3029
3095
  name: "Suspense",
@@ -3558,7 +3624,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3558
3624
  }
3559
3625
  if (isArray(s)) {
3560
3626
  const singleChild = filterSingleRoot(s);
3561
- if (!singleChild) {
3627
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3562
3628
  warn(`<Suspense> slots expect a single root node.`);
3563
3629
  }
3564
3630
  s = singleChild;
@@ -3756,6 +3822,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3756
3822
  let onCleanup = (fn) => {
3757
3823
  cleanup = effect.onStop = () => {
3758
3824
  callWithErrorHandling(fn, instance, 4);
3825
+ cleanup = effect.onStop = void 0;
3759
3826
  };
3760
3827
  };
3761
3828
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4233,7 +4300,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4233
4300
  }
4234
4301
  }
4235
4302
  function getKeepAliveChild(vnode) {
4236
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4303
+ return isKeepAlive(vnode) ? (
4304
+ // #7121 ensure get the child component subtree in case
4305
+ // it's been replaced during HMR
4306
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4307
+ ) : vnode;
4237
4308
  }
4238
4309
  function setTransitionHooks(vnode, hooks) {
4239
4310
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4749,65 +4820,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4749
4820
  return listeners;
4750
4821
  }
4751
4822
 
4752
- const COMPONENTS = "components";
4753
- const DIRECTIVES = "directives";
4754
- const FILTERS = "filters";
4755
- function resolveComponent(name, maybeSelfReference) {
4756
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4757
- }
4758
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4759
- function resolveDynamicComponent(component) {
4760
- if (isString(component)) {
4761
- return resolveAsset(COMPONENTS, component, false) || component;
4762
- } else {
4763
- return component || NULL_DYNAMIC_COMPONENT;
4764
- }
4765
- }
4766
- function resolveDirective(name) {
4767
- return resolveAsset(DIRECTIVES, name);
4768
- }
4769
- function resolveFilter$1(name) {
4770
- return resolveAsset(FILTERS, name);
4771
- }
4772
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4773
- const instance = currentRenderingInstance || currentInstance;
4774
- if (instance) {
4775
- const Component = instance.type;
4776
- if (type === COMPONENTS) {
4777
- const selfName = getComponentName(
4778
- Component,
4779
- false
4780
- /* do not include inferred name to avoid breaking existing code */
4781
- );
4782
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4783
- return Component;
4784
- }
4785
- }
4786
- const res = (
4787
- // local registration
4788
- // check instance[type] first which is resolved for options API
4789
- resolve(instance[type] || Component[type], name) || // global registration
4790
- resolve(instance.appContext[type], name)
4791
- );
4792
- if (!res && maybeSelfReference) {
4793
- return Component;
4794
- }
4795
- if (warnMissing && !res) {
4796
- const extra = type === COMPONENTS ? `
4797
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4798
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4799
- }
4800
- return res;
4801
- } else {
4802
- warn(
4803
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4804
- );
4805
- }
4806
- }
4807
- function resolve(registry, name) {
4808
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4809
- }
4810
-
4811
4823
  function convertLegacyRenderFn(instance) {
4812
4824
  const Component2 = instance.type;
4813
4825
  const render = Component2.render;
@@ -6313,7 +6325,7 @@ If this is a native custom element, make sure to exclude it from component resol
6313
6325
  return vm;
6314
6326
  }
6315
6327
  }
6316
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6328
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.2"}`;
6317
6329
  Vue.config = singletonApp.config;
6318
6330
  Vue.use = (p, ...options) => {
6319
6331
  if (p && isFunction(p.install)) {
@@ -7341,6 +7353,9 @@ If you want to remount the same app, move your app creation logic into a factory
7341
7353
  };
7342
7354
  }
7343
7355
  function getInvalidTypeMessage(name, value, expectedTypes) {
7356
+ if (expectedTypes.length === 0) {
7357
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7358
+ }
7344
7359
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7345
7360
  const expectedType = expectedTypes[0];
7346
7361
  const receivedType = toRawType(value);
@@ -7612,6 +7627,20 @@ If you want to remount the same app, move your app creation logic into a factory
7612
7627
  const { type, ref, shapeFlag, patchFlag } = vnode;
7613
7628
  let domType = node.nodeType;
7614
7629
  vnode.el = node;
7630
+ {
7631
+ if (!("__vnode" in node)) {
7632
+ Object.defineProperty(node, "__vnode", {
7633
+ value: vnode,
7634
+ enumerable: false
7635
+ });
7636
+ }
7637
+ if (!("__vueParentComponent" in node)) {
7638
+ Object.defineProperty(node, "__vueParentComponent", {
7639
+ value: parentComponent,
7640
+ enumerable: false
7641
+ });
7642
+ }
7643
+ }
7615
7644
  if (patchFlag === -2) {
7616
7645
  optimized = false;
7617
7646
  vnode.dynamicChildren = null;
@@ -7642,15 +7671,15 @@ If you want to remount the same app, move your app creation logic into a factory
7642
7671
  }
7643
7672
  break;
7644
7673
  case Comment:
7645
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7646
- if (node.tagName.toLowerCase() === "template") {
7647
- const content = vnode.el.content.firstChild;
7648
- replaceNode(content, node, parentComponent);
7649
- vnode.el = node = content;
7650
- nextNode = nextSibling(node);
7651
- } else {
7652
- nextNode = onMismatch();
7653
- }
7674
+ if (isTemplateNode(node)) {
7675
+ nextNode = nextSibling(node);
7676
+ replaceNode(
7677
+ vnode.el = node.content.firstChild,
7678
+ node,
7679
+ parentComponent
7680
+ );
7681
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7682
+ nextNode = onMismatch();
7654
7683
  } else {
7655
7684
  nextNode = nextSibling(node);
7656
7685
  }
@@ -7773,15 +7802,16 @@ If you want to remount the same app, move your app creation logic into a factory
7773
7802
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7774
7803
  optimized = optimized || !!vnode.dynamicChildren;
7775
7804
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7776
- const forcePatchValue = type === "input" && dirs || type === "option";
7805
+ const forcePatch = type === "input" || type === "option";
7777
7806
  {
7778
7807
  if (dirs) {
7779
7808
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7780
7809
  }
7781
7810
  if (props) {
7782
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7811
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7783
7812
  for (const key in props) {
7784
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7813
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7814
+ key[0] === ".") {
7785
7815
  patchProp(
7786
7816
  el,
7787
7817
  key,
@@ -7994,8 +8024,7 @@ If you want to remount the same app, move your app creation logic into a factory
7994
8024
  let parent = parentComponent;
7995
8025
  while (parent) {
7996
8026
  if (parent.vnode.el === oldNode) {
7997
- parent.vnode.el = newNode;
7998
- parent.subTree.el = newNode;
8027
+ parent.vnode.el = parent.subTree.el = newNode;
7999
8028
  }
8000
8029
  parent = parent.parent;
8001
8030
  }
@@ -9579,6 +9608,7 @@ If you want to remount the same app, move your app creation logic into a factory
9579
9608
  }
9580
9609
  };
9581
9610
  const TeleportImpl = {
9611
+ name: "Teleport",
9582
9612
  __isTeleport: true,
9583
9613
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9584
9614
  const {
@@ -10058,7 +10088,7 @@ If you want to remount the same app, move your app creation logic into a factory
10058
10088
  if (shapeFlag & 4 && isProxy(type)) {
10059
10089
  type = toRaw(type);
10060
10090
  warn(
10061
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10091
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10062
10092
  `
10063
10093
  Component that was made reactive: `,
10064
10094
  type
@@ -10888,7 +10918,7 @@ Component that was made reactive: `,
10888
10918
  return true;
10889
10919
  }
10890
10920
 
10891
- const version = "3.4.0-alpha.1";
10921
+ const version = "3.4.0-alpha.2";
10892
10922
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10893
10923
  const ssrUtils = null;
10894
10924
  const resolveFilter = resolveFilter$1 ;
@@ -12118,21 +12148,20 @@ Component that was made reactive: `,
12118
12148
  el[assignKey] = getModelAssigner(vnode);
12119
12149
  if (el.composing)
12120
12150
  return;
12151
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12152
+ const newValue = value == null ? "" : value;
12153
+ if (elValue === newValue) {
12154
+ return;
12155
+ }
12121
12156
  if (document.activeElement === el && el.type !== "range") {
12122
12157
  if (lazy) {
12123
12158
  return;
12124
12159
  }
12125
- if (trim && el.value.trim() === value) {
12126
- return;
12127
- }
12128
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12160
+ if (trim && el.value.trim() === newValue) {
12129
12161
  return;
12130
12162
  }
12131
12163
  }
12132
- const newValue = value == null ? "" : value;
12133
- if (el.value !== newValue) {
12134
- el.value = newValue;
12135
- }
12164
+ el.value = newValue;
12136
12165
  }
12137
12166
  };
12138
12167
  const vModelCheckbox = {
@@ -12697,83 +12726,6 @@ Make sure to use the production build (*.prod.js) when deploying for production.
12697
12726
  return Vue;
12698
12727
  }
12699
12728
 
12700
- function defaultOnError(error) {
12701
- throw error;
12702
- }
12703
- function defaultOnWarn(msg) {
12704
- console.warn(`[Vue warn] ${msg.message}`);
12705
- }
12706
- function createCompilerError(code, loc, messages, additionalMessage) {
12707
- const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
12708
- const error = new SyntaxError(String(msg));
12709
- error.code = code;
12710
- error.loc = loc;
12711
- return error;
12712
- }
12713
- const errorMessages = {
12714
- // parse errors
12715
- [0]: "Illegal comment.",
12716
- [1]: "CDATA section is allowed only in XML context.",
12717
- [2]: "Duplicate attribute.",
12718
- [3]: "End tag cannot have attributes.",
12719
- [4]: "Illegal '/' in tags.",
12720
- [5]: "Unexpected EOF in tag.",
12721
- [6]: "Unexpected EOF in CDATA section.",
12722
- [7]: "Unexpected EOF in comment.",
12723
- [8]: "Unexpected EOF in script.",
12724
- [9]: "Unexpected EOF in tag.",
12725
- [10]: "Incorrectly closed comment.",
12726
- [11]: "Incorrectly opened comment.",
12727
- [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12728
- [13]: "Attribute value was expected.",
12729
- [14]: "End tag name was expected.",
12730
- [15]: "Whitespace was expected.",
12731
- [16]: "Unexpected '<!--' in comment.",
12732
- [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12733
- [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12734
- [19]: "Attribute name cannot start with '='.",
12735
- [21]: "'<?' is allowed only in XML context.",
12736
- [20]: `Unexpected null character.`,
12737
- [22]: "Illegal '/' in tags.",
12738
- // Vue-specific parse errors
12739
- [23]: "Invalid end tag.",
12740
- [24]: "Element is missing end tag.",
12741
- [25]: "Interpolation end sign was not found.",
12742
- [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12743
- [26]: "Legal directive name was expected.",
12744
- // transform errors
12745
- [28]: `v-if/v-else-if is missing expression.`,
12746
- [29]: `v-if/else branches must use unique keys.`,
12747
- [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12748
- [31]: `v-for is missing expression.`,
12749
- [32]: `v-for has invalid expression.`,
12750
- [33]: `<template v-for> key should be placed on the <template> tag.`,
12751
- [34]: `v-bind is missing expression.`,
12752
- [35]: `v-on is missing expression.`,
12753
- [36]: `Unexpected custom directive on <slot> outlet.`,
12754
- [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
12755
- [38]: `Duplicate slot names found. `,
12756
- [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12757
- [40]: `v-slot can only be used on components or <template> tags.`,
12758
- [41]: `v-model is missing expression.`,
12759
- [42]: `v-model value must be a valid JavaScript member expression.`,
12760
- [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12761
- [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12762
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12763
- [45]: `Error parsing JavaScript expression: `,
12764
- [46]: `<KeepAlive> expects exactly one child component.`,
12765
- // generic errors
12766
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12767
- [48]: `ES module mode is not supported in this build of compiler.`,
12768
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12769
- [50]: `"scopeId" option is only supported in module mode.`,
12770
- // deprecations
12771
- [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
12772
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12773
- // just to fulfill types
12774
- [53]: ``
12775
- };
12776
-
12777
12729
  const FRAGMENT = Symbol(`Fragment` );
12778
12730
  const TELEPORT = Symbol(`Teleport` );
12779
12731
  const SUSPENSE = Symbol(`Suspense` );
@@ -12863,13 +12815,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12863
12815
  }
12864
12816
 
12865
12817
  const locStub = {
12866
- source: "",
12867
12818
  start: { line: 1, column: 1, offset: 0 },
12868
- end: { line: 1, column: 1, offset: 0 }
12819
+ end: { line: 1, column: 1, offset: 0 },
12820
+ source: ""
12869
12821
  };
12870
- function createRoot(children, loc = locStub) {
12822
+ function createRoot(children, source = "") {
12871
12823
  return {
12872
12824
  type: 0,
12825
+ source,
12873
12826
  children,
12874
12827
  helpers: /* @__PURE__ */ new Set(),
12875
12828
  components: [],
@@ -12879,7 +12832,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12879
12832
  cached: 0,
12880
12833
  temps: 0,
12881
12834
  codegenNode: void 0,
12882
- loc
12835
+ loc: locStub
12883
12836
  };
12884
12837
  }
12885
12838
  function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
@@ -13005,39 +12958,992 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13005
12958
  }
13006
12959
  }
13007
12960
 
13008
- const isStaticExp = (p) => p.type === 4 && p.isStatic;
13009
- const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
13010
- function isCoreComponent(tag) {
13011
- if (isBuiltInType(tag, "Teleport")) {
13012
- return TELEPORT;
13013
- } else if (isBuiltInType(tag, "Suspense")) {
13014
- return SUSPENSE;
13015
- } else if (isBuiltInType(tag, "KeepAlive")) {
13016
- return KEEP_ALIVE;
13017
- } else if (isBuiltInType(tag, "BaseTransition")) {
13018
- return BASE_TRANSITION;
12961
+ const defaultDelimitersOpen = new Uint8Array([123, 123]);
12962
+ const defaultDelimitersClose = new Uint8Array([125, 125]);
12963
+ function isTagStartChar(c) {
12964
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90;
12965
+ }
12966
+ function isWhitespace(c) {
12967
+ return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
12968
+ }
12969
+ function isEndOfTagSection(c) {
12970
+ return c === 47 || c === 62 || isWhitespace(c);
12971
+ }
12972
+ function toCharCodes(str) {
12973
+ const ret = new Uint8Array(str.length);
12974
+ for (let i = 0; i < str.length; i++) {
12975
+ ret[i] = str.charCodeAt(i);
13019
12976
  }
12977
+ return ret;
13020
12978
  }
13021
- const nonIdentifierRE = /^\d|[^\$\w]/;
13022
- const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13023
- const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13024
- const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13025
- const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13026
- const isMemberExpressionBrowser = (path) => {
13027
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
13028
- let state = 0 /* inMemberExp */;
13029
- let stateStack = [];
13030
- let currentOpenBracketCount = 0;
13031
- let currentOpenParensCount = 0;
13032
- let currentStringType = null;
13033
- for (let i = 0; i < path.length; i++) {
13034
- const char = path.charAt(i);
13035
- switch (state) {
13036
- case 0 /* inMemberExp */:
13037
- if (char === "[") {
13038
- stateStack.push(state);
13039
- state = 1 /* inBrackets */;
13040
- currentOpenBracketCount++;
12979
+ const Sequences = {
12980
+ Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
12981
+ // CDATA[
12982
+ CdataEnd: new Uint8Array([93, 93, 62]),
12983
+ // ]]>
12984
+ CommentEnd: new Uint8Array([45, 45, 62]),
12985
+ // `-->`
12986
+ ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
12987
+ // `<\/script`
12988
+ StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
12989
+ // `</style`
12990
+ TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
12991
+ // `</title`
12992
+ TextareaEnd: new Uint8Array([
12993
+ 60,
12994
+ 47,
12995
+ 116,
12996
+ 101,
12997
+ 120,
12998
+ 116,
12999
+ 97,
13000
+ 114,
13001
+ 101,
13002
+ 97
13003
+ ])
13004
+ // `</textarea
13005
+ };
13006
+ class Tokenizer {
13007
+ constructor(stack, cbs) {
13008
+ this.stack = stack;
13009
+ this.cbs = cbs;
13010
+ /** The current state the tokenizer is in. */
13011
+ this.state = 1;
13012
+ /** The read buffer. */
13013
+ this.buffer = "";
13014
+ /** The beginning of the section that is currently being read. */
13015
+ this.sectionStart = 0;
13016
+ /** The index within the buffer that we are currently looking at. */
13017
+ this.index = 0;
13018
+ /** The start of the last entity. */
13019
+ this.entityStart = 0;
13020
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
13021
+ this.baseState = 1;
13022
+ /** For special parsing behavior inside of script and style tags. */
13023
+ this.inRCDATA = false;
13024
+ /** For disabling RCDATA tags handling */
13025
+ this.inXML = false;
13026
+ /** Reocrd newline positions for fast line / column calculation */
13027
+ this.newlines = [];
13028
+ this.mode = 0;
13029
+ this.delimiterOpen = defaultDelimitersOpen;
13030
+ this.delimiterClose = defaultDelimitersClose;
13031
+ this.delimiterIndex = -1;
13032
+ this.currentSequence = void 0;
13033
+ this.sequenceIndex = 0;
13034
+ }
13035
+ get inSFCRoot() {
13036
+ return this.mode === 2 && this.stack.length === 0;
13037
+ }
13038
+ reset() {
13039
+ this.state = 1;
13040
+ this.mode = 0;
13041
+ this.buffer = "";
13042
+ this.sectionStart = 0;
13043
+ this.index = 0;
13044
+ this.baseState = 1;
13045
+ this.currentSequence = void 0;
13046
+ this.newlines.length = 0;
13047
+ this.delimiterOpen = defaultDelimitersOpen;
13048
+ this.delimiterClose = defaultDelimitersClose;
13049
+ }
13050
+ /**
13051
+ * Generate Position object with line / column information using recorded
13052
+ * newline positions. We know the index is always going to be an already
13053
+ * processed index, so all the newlines up to this index should have been
13054
+ * recorded.
13055
+ */
13056
+ getPos(index) {
13057
+ let line = 1;
13058
+ let column = index + 1;
13059
+ for (let i = this.newlines.length - 1; i >= 0; i--) {
13060
+ const newlineIndex = this.newlines[i];
13061
+ if (index > newlineIndex) {
13062
+ line = i + 2;
13063
+ column = index - newlineIndex;
13064
+ break;
13065
+ }
13066
+ }
13067
+ return {
13068
+ column,
13069
+ line,
13070
+ offset: index
13071
+ };
13072
+ }
13073
+ peek() {
13074
+ return this.buffer.charCodeAt(this.index + 1);
13075
+ }
13076
+ stateText(c) {
13077
+ if (c === 60) {
13078
+ if (this.index > this.sectionStart) {
13079
+ this.cbs.ontext(this.sectionStart, this.index);
13080
+ }
13081
+ this.state = 5;
13082
+ this.sectionStart = this.index;
13083
+ } else if (c === this.delimiterOpen[0]) {
13084
+ this.state = 2;
13085
+ this.delimiterIndex = 0;
13086
+ this.stateInterpolationOpen(c);
13087
+ }
13088
+ }
13089
+ stateInterpolationOpen(c) {
13090
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
13091
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
13092
+ const start = this.index + 1 - this.delimiterOpen.length;
13093
+ if (start > this.sectionStart) {
13094
+ this.cbs.ontext(this.sectionStart, start);
13095
+ }
13096
+ this.state = 3;
13097
+ this.sectionStart = start;
13098
+ } else {
13099
+ this.delimiterIndex++;
13100
+ }
13101
+ } else if (this.inRCDATA) {
13102
+ this.state = 32;
13103
+ this.stateInRCDATA(c);
13104
+ } else {
13105
+ this.state = 1;
13106
+ this.stateText(c);
13107
+ }
13108
+ }
13109
+ stateInterpolation(c) {
13110
+ if (c === this.delimiterClose[0]) {
13111
+ this.state = 4;
13112
+ this.delimiterIndex = 0;
13113
+ this.stateInterpolationClose(c);
13114
+ }
13115
+ }
13116
+ stateInterpolationClose(c) {
13117
+ if (c === this.delimiterClose[this.delimiterIndex]) {
13118
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
13119
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
13120
+ if (this.inRCDATA) {
13121
+ this.state = 32;
13122
+ } else {
13123
+ this.state = 1;
13124
+ }
13125
+ this.sectionStart = this.index + 1;
13126
+ } else {
13127
+ this.delimiterIndex++;
13128
+ }
13129
+ } else {
13130
+ this.state = 3;
13131
+ this.stateInterpolation(c);
13132
+ }
13133
+ }
13134
+ stateSpecialStartSequence(c) {
13135
+ const isEnd = this.sequenceIndex === this.currentSequence.length;
13136
+ const isMatch = isEnd ? (
13137
+ // If we are at the end of the sequence, make sure the tag name has ended
13138
+ isEndOfTagSection(c)
13139
+ ) : (
13140
+ // Otherwise, do a case-insensitive comparison
13141
+ (c | 32) === this.currentSequence[this.sequenceIndex]
13142
+ );
13143
+ if (!isMatch) {
13144
+ this.inRCDATA = false;
13145
+ } else if (!isEnd) {
13146
+ this.sequenceIndex++;
13147
+ return;
13148
+ }
13149
+ this.sequenceIndex = 0;
13150
+ this.state = 6;
13151
+ this.stateInTagName(c);
13152
+ }
13153
+ /** Look for an end tag. For <title> and <textarea>, also decode entities. */
13154
+ stateInRCDATA(c) {
13155
+ if (this.sequenceIndex === this.currentSequence.length) {
13156
+ if (c === 62 || isWhitespace(c)) {
13157
+ const endOfText = this.index - this.currentSequence.length;
13158
+ if (this.sectionStart < endOfText) {
13159
+ const actualIndex = this.index;
13160
+ this.index = endOfText;
13161
+ this.cbs.ontext(this.sectionStart, endOfText);
13162
+ this.index = actualIndex;
13163
+ }
13164
+ this.sectionStart = endOfText + 2;
13165
+ this.stateInClosingTagName(c);
13166
+ this.inRCDATA = false;
13167
+ return;
13168
+ }
13169
+ this.sequenceIndex = 0;
13170
+ }
13171
+ if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
13172
+ this.sequenceIndex += 1;
13173
+ } else if (this.sequenceIndex === 0) {
13174
+ if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
13175
+ if (c === this.delimiterOpen[0]) {
13176
+ this.state = 2;
13177
+ this.delimiterIndex = 0;
13178
+ this.stateInterpolationOpen(c);
13179
+ }
13180
+ } else if (this.fastForwardTo(60)) {
13181
+ this.sequenceIndex = 1;
13182
+ }
13183
+ } else {
13184
+ this.sequenceIndex = Number(c === 60);
13185
+ }
13186
+ }
13187
+ stateCDATASequence(c) {
13188
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
13189
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
13190
+ this.state = 28;
13191
+ this.currentSequence = Sequences.CdataEnd;
13192
+ this.sequenceIndex = 0;
13193
+ this.sectionStart = this.index + 1;
13194
+ }
13195
+ } else {
13196
+ this.sequenceIndex = 0;
13197
+ this.state = 23;
13198
+ this.stateInDeclaration(c);
13199
+ }
13200
+ }
13201
+ /**
13202
+ * When we wait for one specific character, we can speed things up
13203
+ * by skipping through the buffer until we find it.
13204
+ *
13205
+ * @returns Whether the character was found.
13206
+ */
13207
+ fastForwardTo(c) {
13208
+ while (++this.index < this.buffer.length) {
13209
+ const cc = this.buffer.charCodeAt(this.index);
13210
+ if (cc === 10) {
13211
+ this.newlines.push(this.index);
13212
+ }
13213
+ if (cc === c) {
13214
+ return true;
13215
+ }
13216
+ }
13217
+ this.index = this.buffer.length - 1;
13218
+ return false;
13219
+ }
13220
+ /**
13221
+ * Comments and CDATA end with `-->` and `]]>`.
13222
+ *
13223
+ * Their common qualities are:
13224
+ * - Their end sequences have a distinct character they start with.
13225
+ * - That character is then repeated, so we have to check multiple repeats.
13226
+ * - All characters but the start character of the sequence can be skipped.
13227
+ */
13228
+ stateInCommentLike(c) {
13229
+ if (c === this.currentSequence[this.sequenceIndex]) {
13230
+ if (++this.sequenceIndex === this.currentSequence.length) {
13231
+ if (this.currentSequence === Sequences.CdataEnd) {
13232
+ this.cbs.oncdata(this.sectionStart, this.index - 2);
13233
+ } else {
13234
+ this.cbs.oncomment(this.sectionStart, this.index - 2);
13235
+ }
13236
+ this.sequenceIndex = 0;
13237
+ this.sectionStart = this.index + 1;
13238
+ this.state = 1;
13239
+ }
13240
+ } else if (this.sequenceIndex === 0) {
13241
+ if (this.fastForwardTo(this.currentSequence[0])) {
13242
+ this.sequenceIndex = 1;
13243
+ }
13244
+ } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
13245
+ this.sequenceIndex = 0;
13246
+ }
13247
+ }
13248
+ startSpecial(sequence, offset) {
13249
+ this.enterRCDATA(sequence, offset);
13250
+ this.state = 31;
13251
+ }
13252
+ enterRCDATA(sequence, offset) {
13253
+ this.inRCDATA = true;
13254
+ this.currentSequence = sequence;
13255
+ this.sequenceIndex = offset;
13256
+ }
13257
+ stateBeforeTagName(c) {
13258
+ if (c === 33) {
13259
+ this.state = 22;
13260
+ this.sectionStart = this.index + 1;
13261
+ } else if (c === 63) {
13262
+ this.state = 24;
13263
+ this.sectionStart = this.index + 1;
13264
+ } else if (isTagStartChar(c)) {
13265
+ this.sectionStart = this.index;
13266
+ if (this.mode === 0) {
13267
+ this.state = 6;
13268
+ } else if (this.inSFCRoot) {
13269
+ this.state = 34;
13270
+ } else if (!this.inXML) {
13271
+ const lower = c | 32;
13272
+ if (lower === 116) {
13273
+ this.state = 30;
13274
+ } else {
13275
+ this.state = lower === 115 ? 29 : 6;
13276
+ }
13277
+ } else {
13278
+ this.state = 6;
13279
+ }
13280
+ } else if (c === 47) {
13281
+ this.state = 8;
13282
+ } else {
13283
+ this.state = 1;
13284
+ this.stateText(c);
13285
+ }
13286
+ }
13287
+ stateInTagName(c) {
13288
+ if (isEndOfTagSection(c)) {
13289
+ this.handleTagName(c);
13290
+ }
13291
+ }
13292
+ stateInSFCRootTagName(c) {
13293
+ if (isEndOfTagSection(c)) {
13294
+ const tag = this.buffer.slice(this.sectionStart, this.index);
13295
+ if (tag !== "template") {
13296
+ this.enterRCDATA(toCharCodes(`</` + tag), 0);
13297
+ }
13298
+ this.handleTagName(c);
13299
+ }
13300
+ }
13301
+ handleTagName(c) {
13302
+ this.cbs.onopentagname(this.sectionStart, this.index);
13303
+ this.sectionStart = -1;
13304
+ this.state = 11;
13305
+ this.stateBeforeAttrName(c);
13306
+ }
13307
+ stateBeforeClosingTagName(c) {
13308
+ if (isWhitespace(c)) ; else if (c === 62) {
13309
+ {
13310
+ this.cbs.onerr(14, this.index);
13311
+ }
13312
+ this.state = 1;
13313
+ this.sectionStart = this.index + 1;
13314
+ } else {
13315
+ this.state = isTagStartChar(c) ? 9 : 27;
13316
+ this.sectionStart = this.index;
13317
+ }
13318
+ }
13319
+ stateInClosingTagName(c) {
13320
+ if (c === 62 || isWhitespace(c)) {
13321
+ this.cbs.onclosetag(this.sectionStart, this.index);
13322
+ this.sectionStart = -1;
13323
+ this.state = 10;
13324
+ this.stateAfterClosingTagName(c);
13325
+ }
13326
+ }
13327
+ stateAfterClosingTagName(c) {
13328
+ if (c === 62) {
13329
+ this.state = 1;
13330
+ this.sectionStart = this.index + 1;
13331
+ }
13332
+ }
13333
+ stateBeforeAttrName(c) {
13334
+ if (c === 62) {
13335
+ this.cbs.onopentagend(this.index);
13336
+ if (this.inRCDATA) {
13337
+ this.state = 32;
13338
+ } else {
13339
+ this.state = 1;
13340
+ }
13341
+ this.sectionStart = this.index + 1;
13342
+ } else if (c === 47) {
13343
+ this.state = 7;
13344
+ if (this.peek() !== 62) {
13345
+ this.cbs.onerr(22, this.index);
13346
+ }
13347
+ } else if (c === 60 && this.peek() === 47) {
13348
+ this.cbs.onopentagend(this.index);
13349
+ this.state = 5;
13350
+ this.sectionStart = this.index;
13351
+ } else if (!isWhitespace(c)) {
13352
+ if (c === 61) {
13353
+ this.cbs.onerr(
13354
+ 19,
13355
+ this.index
13356
+ );
13357
+ }
13358
+ this.handleAttrStart(c);
13359
+ }
13360
+ }
13361
+ handleAttrStart(c) {
13362
+ if (c === 118 && this.peek() === 45) {
13363
+ this.state = 13;
13364
+ this.sectionStart = this.index;
13365
+ } else if (c === 46 || c === 58 || c === 64 || c === 35) {
13366
+ this.cbs.ondirname(this.index, this.index + 1);
13367
+ this.state = 14;
13368
+ this.sectionStart = this.index + 1;
13369
+ } else {
13370
+ this.state = 12;
13371
+ this.sectionStart = this.index;
13372
+ }
13373
+ }
13374
+ stateInSelfClosingTag(c) {
13375
+ if (c === 62) {
13376
+ this.cbs.onselfclosingtag(this.index);
13377
+ this.state = 1;
13378
+ this.sectionStart = this.index + 1;
13379
+ this.inRCDATA = false;
13380
+ } else if (!isWhitespace(c)) {
13381
+ this.state = 11;
13382
+ this.stateBeforeAttrName(c);
13383
+ }
13384
+ }
13385
+ stateInAttrName(c) {
13386
+ if (c === 61 || isEndOfTagSection(c)) {
13387
+ this.cbs.onattribname(this.sectionStart, this.index);
13388
+ this.handleAttrNameEnd(c);
13389
+ } else if (c === 34 || c === 39 || c === 60) {
13390
+ this.cbs.onerr(
13391
+ 17,
13392
+ this.index
13393
+ );
13394
+ }
13395
+ }
13396
+ stateInDirName(c) {
13397
+ if (c === 61 || isEndOfTagSection(c)) {
13398
+ this.cbs.ondirname(this.sectionStart, this.index);
13399
+ this.handleAttrNameEnd(c);
13400
+ } else if (c === 58) {
13401
+ this.cbs.ondirname(this.sectionStart, this.index);
13402
+ this.state = 14;
13403
+ this.sectionStart = this.index + 1;
13404
+ } else if (c === 46) {
13405
+ this.cbs.ondirname(this.sectionStart, this.index);
13406
+ this.state = 16;
13407
+ this.sectionStart = this.index + 1;
13408
+ }
13409
+ }
13410
+ stateInDirArg(c) {
13411
+ if (c === 61 || isEndOfTagSection(c)) {
13412
+ this.cbs.ondirarg(this.sectionStart, this.index);
13413
+ this.handleAttrNameEnd(c);
13414
+ } else if (c === 91) {
13415
+ this.state = 15;
13416
+ } else if (c === 46) {
13417
+ this.cbs.ondirarg(this.sectionStart, this.index);
13418
+ this.state = 16;
13419
+ this.sectionStart = this.index + 1;
13420
+ }
13421
+ }
13422
+ stateInDynamicDirArg(c) {
13423
+ if (c === 93) {
13424
+ this.state = 14;
13425
+ } else if (c === 61 || isEndOfTagSection(c)) {
13426
+ this.cbs.ondirarg(this.sectionStart, this.index + 1);
13427
+ this.handleAttrNameEnd(c);
13428
+ {
13429
+ this.cbs.onerr(
13430
+ 27,
13431
+ this.index
13432
+ );
13433
+ }
13434
+ }
13435
+ }
13436
+ stateInDirModifier(c) {
13437
+ if (c === 61 || isEndOfTagSection(c)) {
13438
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13439
+ this.handleAttrNameEnd(c);
13440
+ } else if (c === 46) {
13441
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13442
+ this.sectionStart = this.index + 1;
13443
+ }
13444
+ }
13445
+ handleAttrNameEnd(c) {
13446
+ this.sectionStart = this.index;
13447
+ this.state = 17;
13448
+ this.cbs.onattribnameend(this.index);
13449
+ this.stateAfterAttrName(c);
13450
+ }
13451
+ stateAfterAttrName(c) {
13452
+ if (c === 61) {
13453
+ this.state = 18;
13454
+ } else if (c === 47 || c === 62) {
13455
+ this.cbs.onattribend(0, this.sectionStart);
13456
+ this.sectionStart = -1;
13457
+ this.state = 11;
13458
+ this.stateBeforeAttrName(c);
13459
+ } else if (!isWhitespace(c)) {
13460
+ this.cbs.onattribend(0, this.sectionStart);
13461
+ this.handleAttrStart(c);
13462
+ }
13463
+ }
13464
+ stateBeforeAttrValue(c) {
13465
+ if (c === 34) {
13466
+ this.state = 19;
13467
+ this.sectionStart = this.index + 1;
13468
+ } else if (c === 39) {
13469
+ this.state = 20;
13470
+ this.sectionStart = this.index + 1;
13471
+ } else if (!isWhitespace(c)) {
13472
+ this.sectionStart = this.index;
13473
+ this.state = 21;
13474
+ this.stateInAttrValueNoQuotes(c);
13475
+ }
13476
+ }
13477
+ handleInAttrValue(c, quote) {
13478
+ if (c === quote || this.fastForwardTo(quote)) {
13479
+ this.cbs.onattribdata(this.sectionStart, this.index);
13480
+ this.sectionStart = -1;
13481
+ this.cbs.onattribend(
13482
+ quote === 34 ? 3 : 2,
13483
+ this.index + 1
13484
+ );
13485
+ this.state = 11;
13486
+ }
13487
+ }
13488
+ stateInAttrValueDoubleQuotes(c) {
13489
+ this.handleInAttrValue(c, 34);
13490
+ }
13491
+ stateInAttrValueSingleQuotes(c) {
13492
+ this.handleInAttrValue(c, 39);
13493
+ }
13494
+ stateInAttrValueNoQuotes(c) {
13495
+ if (isWhitespace(c) || c === 62) {
13496
+ this.cbs.onattribdata(this.sectionStart, this.index);
13497
+ this.sectionStart = -1;
13498
+ this.cbs.onattribend(1, this.index);
13499
+ this.state = 11;
13500
+ this.stateBeforeAttrName(c);
13501
+ } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13502
+ this.cbs.onerr(
13503
+ 18,
13504
+ this.index
13505
+ );
13506
+ } else ;
13507
+ }
13508
+ stateBeforeDeclaration(c) {
13509
+ if (c === 91) {
13510
+ this.state = 26;
13511
+ this.sequenceIndex = 0;
13512
+ } else {
13513
+ this.state = c === 45 ? 25 : 23;
13514
+ }
13515
+ }
13516
+ stateInDeclaration(c) {
13517
+ if (c === 62 || this.fastForwardTo(62)) {
13518
+ this.state = 1;
13519
+ this.sectionStart = this.index + 1;
13520
+ }
13521
+ }
13522
+ stateInProcessingInstruction(c) {
13523
+ if (c === 62 || this.fastForwardTo(62)) {
13524
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13525
+ this.state = 1;
13526
+ this.sectionStart = this.index + 1;
13527
+ }
13528
+ }
13529
+ stateBeforeComment(c) {
13530
+ if (c === 45) {
13531
+ this.state = 28;
13532
+ this.currentSequence = Sequences.CommentEnd;
13533
+ this.sequenceIndex = 2;
13534
+ this.sectionStart = this.index + 1;
13535
+ } else {
13536
+ this.state = 23;
13537
+ }
13538
+ }
13539
+ stateInSpecialComment(c) {
13540
+ if (c === 62 || this.fastForwardTo(62)) {
13541
+ this.cbs.oncomment(this.sectionStart, this.index);
13542
+ this.state = 1;
13543
+ this.sectionStart = this.index + 1;
13544
+ }
13545
+ }
13546
+ stateBeforeSpecialS(c) {
13547
+ const lower = c | 32;
13548
+ if (lower === Sequences.ScriptEnd[3]) {
13549
+ this.startSpecial(Sequences.ScriptEnd, 4);
13550
+ } else if (lower === Sequences.StyleEnd[3]) {
13551
+ this.startSpecial(Sequences.StyleEnd, 4);
13552
+ } else {
13553
+ this.state = 6;
13554
+ this.stateInTagName(c);
13555
+ }
13556
+ }
13557
+ stateBeforeSpecialT(c) {
13558
+ const lower = c | 32;
13559
+ if (lower === Sequences.TitleEnd[3]) {
13560
+ this.startSpecial(Sequences.TitleEnd, 4);
13561
+ } else if (lower === Sequences.TextareaEnd[3]) {
13562
+ this.startSpecial(Sequences.TextareaEnd, 4);
13563
+ } else {
13564
+ this.state = 6;
13565
+ this.stateInTagName(c);
13566
+ }
13567
+ }
13568
+ startEntity() {
13569
+ }
13570
+ stateInEntity() {
13571
+ }
13572
+ /**
13573
+ * Iterates through the buffer, calling the function corresponding to the current state.
13574
+ *
13575
+ * States that are more likely to be hit are higher up, as a performance improvement.
13576
+ */
13577
+ parse(input) {
13578
+ this.buffer = input;
13579
+ while (this.index < this.buffer.length) {
13580
+ const c = this.buffer.charCodeAt(this.index);
13581
+ if (c === 10) {
13582
+ this.newlines.push(this.index);
13583
+ }
13584
+ switch (this.state) {
13585
+ case 1: {
13586
+ this.stateText(c);
13587
+ break;
13588
+ }
13589
+ case 2: {
13590
+ this.stateInterpolationOpen(c);
13591
+ break;
13592
+ }
13593
+ case 3: {
13594
+ this.stateInterpolation(c);
13595
+ break;
13596
+ }
13597
+ case 4: {
13598
+ this.stateInterpolationClose(c);
13599
+ break;
13600
+ }
13601
+ case 31: {
13602
+ this.stateSpecialStartSequence(c);
13603
+ break;
13604
+ }
13605
+ case 32: {
13606
+ this.stateInRCDATA(c);
13607
+ break;
13608
+ }
13609
+ case 26: {
13610
+ this.stateCDATASequence(c);
13611
+ break;
13612
+ }
13613
+ case 19: {
13614
+ this.stateInAttrValueDoubleQuotes(c);
13615
+ break;
13616
+ }
13617
+ case 12: {
13618
+ this.stateInAttrName(c);
13619
+ break;
13620
+ }
13621
+ case 13: {
13622
+ this.stateInDirName(c);
13623
+ break;
13624
+ }
13625
+ case 14: {
13626
+ this.stateInDirArg(c);
13627
+ break;
13628
+ }
13629
+ case 15: {
13630
+ this.stateInDynamicDirArg(c);
13631
+ break;
13632
+ }
13633
+ case 16: {
13634
+ this.stateInDirModifier(c);
13635
+ break;
13636
+ }
13637
+ case 28: {
13638
+ this.stateInCommentLike(c);
13639
+ break;
13640
+ }
13641
+ case 27: {
13642
+ this.stateInSpecialComment(c);
13643
+ break;
13644
+ }
13645
+ case 11: {
13646
+ this.stateBeforeAttrName(c);
13647
+ break;
13648
+ }
13649
+ case 6: {
13650
+ this.stateInTagName(c);
13651
+ break;
13652
+ }
13653
+ case 34: {
13654
+ this.stateInSFCRootTagName(c);
13655
+ break;
13656
+ }
13657
+ case 9: {
13658
+ this.stateInClosingTagName(c);
13659
+ break;
13660
+ }
13661
+ case 5: {
13662
+ this.stateBeforeTagName(c);
13663
+ break;
13664
+ }
13665
+ case 17: {
13666
+ this.stateAfterAttrName(c);
13667
+ break;
13668
+ }
13669
+ case 20: {
13670
+ this.stateInAttrValueSingleQuotes(c);
13671
+ break;
13672
+ }
13673
+ case 18: {
13674
+ this.stateBeforeAttrValue(c);
13675
+ break;
13676
+ }
13677
+ case 8: {
13678
+ this.stateBeforeClosingTagName(c);
13679
+ break;
13680
+ }
13681
+ case 10: {
13682
+ this.stateAfterClosingTagName(c);
13683
+ break;
13684
+ }
13685
+ case 29: {
13686
+ this.stateBeforeSpecialS(c);
13687
+ break;
13688
+ }
13689
+ case 30: {
13690
+ this.stateBeforeSpecialT(c);
13691
+ break;
13692
+ }
13693
+ case 21: {
13694
+ this.stateInAttrValueNoQuotes(c);
13695
+ break;
13696
+ }
13697
+ case 7: {
13698
+ this.stateInSelfClosingTag(c);
13699
+ break;
13700
+ }
13701
+ case 23: {
13702
+ this.stateInDeclaration(c);
13703
+ break;
13704
+ }
13705
+ case 22: {
13706
+ this.stateBeforeDeclaration(c);
13707
+ break;
13708
+ }
13709
+ case 25: {
13710
+ this.stateBeforeComment(c);
13711
+ break;
13712
+ }
13713
+ case 24: {
13714
+ this.stateInProcessingInstruction(c);
13715
+ break;
13716
+ }
13717
+ case 33: {
13718
+ this.stateInEntity();
13719
+ break;
13720
+ }
13721
+ }
13722
+ this.index++;
13723
+ }
13724
+ this.cleanup();
13725
+ this.finish();
13726
+ }
13727
+ /**
13728
+ * Remove data that has already been consumed from the buffer.
13729
+ */
13730
+ cleanup() {
13731
+ if (this.sectionStart !== this.index) {
13732
+ if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13733
+ this.cbs.ontext(this.sectionStart, this.index);
13734
+ this.sectionStart = this.index;
13735
+ } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13736
+ this.cbs.onattribdata(this.sectionStart, this.index);
13737
+ this.sectionStart = this.index;
13738
+ }
13739
+ }
13740
+ }
13741
+ finish() {
13742
+ this.handleTrailingData();
13743
+ this.cbs.onend();
13744
+ }
13745
+ /** Handle any trailing data. */
13746
+ handleTrailingData() {
13747
+ const endIndex = this.buffer.length;
13748
+ if (this.sectionStart >= endIndex) {
13749
+ return;
13750
+ }
13751
+ if (this.state === 28) {
13752
+ if (this.currentSequence === Sequences.CdataEnd) {
13753
+ this.cbs.oncdata(this.sectionStart, endIndex);
13754
+ } else {
13755
+ this.cbs.oncomment(this.sectionStart, endIndex);
13756
+ }
13757
+ } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
13758
+ this.cbs.ontext(this.sectionStart, endIndex);
13759
+ }
13760
+ }
13761
+ emitCodePoint(cp, consumed) {
13762
+ }
13763
+ }
13764
+
13765
+ const deprecationData = {
13766
+ ["COMPILER_IS_ON_ELEMENT"]: {
13767
+ message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
13768
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13769
+ },
13770
+ ["COMPILER_V_BIND_SYNC"]: {
13771
+ message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
13772
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13773
+ },
13774
+ ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13775
+ message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
13776
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13777
+ },
13778
+ ["COMPILER_V_ON_NATIVE"]: {
13779
+ message: `.native modifier for v-on has been removed as is no longer necessary.`,
13780
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13781
+ },
13782
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13783
+ message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
13784
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13785
+ },
13786
+ ["COMPILER_NATIVE_TEMPLATE"]: {
13787
+ message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13788
+ },
13789
+ ["COMPILER_INLINE_TEMPLATE"]: {
13790
+ message: `"inline-template" has been removed in Vue 3.`,
13791
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13792
+ },
13793
+ ["COMPILER_FILTER"]: {
13794
+ message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
13795
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13796
+ }
13797
+ };
13798
+ function getCompatValue(key, { compatConfig }) {
13799
+ const value = compatConfig && compatConfig[key];
13800
+ if (key === "MODE") {
13801
+ return value || 3;
13802
+ } else {
13803
+ return value;
13804
+ }
13805
+ }
13806
+ function isCompatEnabled(key, context) {
13807
+ const mode = getCompatValue("MODE", context);
13808
+ const value = getCompatValue(key, context);
13809
+ return mode === 3 ? value === true : value !== false;
13810
+ }
13811
+ function checkCompatEnabled(key, context, loc, ...args) {
13812
+ const enabled = isCompatEnabled(key, context);
13813
+ if (enabled) {
13814
+ warnDeprecation(key, context, loc, ...args);
13815
+ }
13816
+ return enabled;
13817
+ }
13818
+ function warnDeprecation(key, context, loc, ...args) {
13819
+ const val = getCompatValue(key, context);
13820
+ if (val === "suppress-warning") {
13821
+ return;
13822
+ }
13823
+ const { message, link } = deprecationData[key];
13824
+ const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13825
+ Details: ${link}` : ``}`;
13826
+ const err = new SyntaxError(msg);
13827
+ err.code = key;
13828
+ if (loc)
13829
+ err.loc = loc;
13830
+ context.onWarn(err);
13831
+ }
13832
+
13833
+ function defaultOnError(error) {
13834
+ throw error;
13835
+ }
13836
+ function defaultOnWarn(msg) {
13837
+ console.warn(`[Vue warn] ${msg.message}`);
13838
+ }
13839
+ function createCompilerError(code, loc, messages, additionalMessage) {
13840
+ const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
13841
+ const error = new SyntaxError(String(msg));
13842
+ error.code = code;
13843
+ error.loc = loc;
13844
+ return error;
13845
+ }
13846
+ const errorMessages = {
13847
+ // parse errors
13848
+ [0]: "Illegal comment.",
13849
+ [1]: "CDATA section is allowed only in XML context.",
13850
+ [2]: "Duplicate attribute.",
13851
+ [3]: "End tag cannot have attributes.",
13852
+ [4]: "Illegal '/' in tags.",
13853
+ [5]: "Unexpected EOF in tag.",
13854
+ [6]: "Unexpected EOF in CDATA section.",
13855
+ [7]: "Unexpected EOF in comment.",
13856
+ [8]: "Unexpected EOF in script.",
13857
+ [9]: "Unexpected EOF in tag.",
13858
+ [10]: "Incorrectly closed comment.",
13859
+ [11]: "Incorrectly opened comment.",
13860
+ [12]: "Illegal tag name. Use '&lt;' to print '<'.",
13861
+ [13]: "Attribute value was expected.",
13862
+ [14]: "End tag name was expected.",
13863
+ [15]: "Whitespace was expected.",
13864
+ [16]: "Unexpected '<!--' in comment.",
13865
+ [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
13866
+ [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
13867
+ [19]: "Attribute name cannot start with '='.",
13868
+ [21]: "'<?' is allowed only in XML context.",
13869
+ [20]: `Unexpected null character.`,
13870
+ [22]: "Illegal '/' in tags.",
13871
+ // Vue-specific parse errors
13872
+ [23]: "Invalid end tag.",
13873
+ [24]: "Element is missing end tag.",
13874
+ [25]: "Interpolation end sign was not found.",
13875
+ [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
13876
+ [26]: "Legal directive name was expected.",
13877
+ // transform errors
13878
+ [28]: `v-if/v-else-if is missing expression.`,
13879
+ [29]: `v-if/else branches must use unique keys.`,
13880
+ [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
13881
+ [31]: `v-for is missing expression.`,
13882
+ [32]: `v-for has invalid expression.`,
13883
+ [33]: `<template v-for> key should be placed on the <template> tag.`,
13884
+ [34]: `v-bind is missing expression.`,
13885
+ [35]: `v-on is missing expression.`,
13886
+ [36]: `Unexpected custom directive on <slot> outlet.`,
13887
+ [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
13888
+ [38]: `Duplicate slot names found. `,
13889
+ [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
13890
+ [40]: `v-slot can only be used on components or <template> tags.`,
13891
+ [41]: `v-model is missing expression.`,
13892
+ [42]: `v-model value must be a valid JavaScript member expression.`,
13893
+ [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
13894
+ [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
13895
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
13896
+ [45]: `Error parsing JavaScript expression: `,
13897
+ [46]: `<KeepAlive> expects exactly one child component.`,
13898
+ // generic errors
13899
+ [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13900
+ [48]: `ES module mode is not supported in this build of compiler.`,
13901
+ [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13902
+ [50]: `"scopeId" option is only supported in module mode.`,
13903
+ // deprecations
13904
+ [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
13905
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
13906
+ // just to fulfill types
13907
+ [53]: ``
13908
+ };
13909
+
13910
+ const isStaticExp = (p) => p.type === 4 && p.isStatic;
13911
+ function isCoreComponent(tag) {
13912
+ switch (tag) {
13913
+ case "Teleport":
13914
+ case "teleport":
13915
+ return TELEPORT;
13916
+ case "Suspense":
13917
+ case "suspense":
13918
+ return SUSPENSE;
13919
+ case "KeepAlive":
13920
+ case "keep-alive":
13921
+ return KEEP_ALIVE;
13922
+ case "BaseTransition":
13923
+ case "base-transition":
13924
+ return BASE_TRANSITION;
13925
+ }
13926
+ }
13927
+ const nonIdentifierRE = /^\d|[^\$\w]/;
13928
+ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13929
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13930
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13931
+ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13932
+ const isMemberExpressionBrowser = (path) => {
13933
+ path = path.trim().replace(whitespaceRE, (s) => s.trim());
13934
+ let state = 0 /* inMemberExp */;
13935
+ let stateStack = [];
13936
+ let currentOpenBracketCount = 0;
13937
+ let currentOpenParensCount = 0;
13938
+ let currentStringType = null;
13939
+ for (let i = 0; i < path.length; i++) {
13940
+ const char = path.charAt(i);
13941
+ switch (state) {
13942
+ case 0 /* inMemberExp */:
13943
+ if (char === "[") {
13944
+ stateStack.push(state);
13945
+ state = 1 /* inBrackets */;
13946
+ currentOpenBracketCount++;
13041
13947
  } else if (char === "(") {
13042
13948
  stateStack.push(state);
13043
13949
  state = 2 /* inParens */;
@@ -13086,43 +13992,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13086
13992
  return !currentOpenBracketCount && !currentOpenParensCount;
13087
13993
  };
13088
13994
  const isMemberExpression = isMemberExpressionBrowser ;
13089
- function getInnerRange(loc, offset, length) {
13090
- const source = loc.source.slice(offset, offset + length);
13091
- const newLoc = {
13092
- source,
13093
- start: advancePositionWithClone(loc.start, loc.source, offset),
13094
- end: loc.end
13095
- };
13096
- if (length != null) {
13097
- newLoc.end = advancePositionWithClone(
13098
- loc.start,
13099
- loc.source,
13100
- offset + length
13101
- );
13102
- }
13103
- return newLoc;
13104
- }
13105
- function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
13106
- return advancePositionWithMutation(
13107
- extend({}, pos),
13108
- source,
13109
- numberOfCharacters
13110
- );
13111
- }
13112
- function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
13113
- let linesCount = 0;
13114
- let lastNewLinePos = -1;
13115
- for (let i = 0; i < numberOfCharacters; i++) {
13116
- if (source.charCodeAt(i) === 10) {
13117
- linesCount++;
13118
- lastNewLinePos = i;
13119
- }
13120
- }
13121
- pos.offset += numberOfCharacters;
13122
- pos.line += linesCount;
13123
- pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
13124
- return pos;
13125
- }
13126
13995
  function assert(condition, msg) {
13127
13996
  if (!condition) {
13128
13997
  throw new Error(msg || `unexpected compiler condition`);
@@ -13228,509 +14097,598 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13228
14097
  ]);
13229
14098
  if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13230
14099
  parentCall = callPath[callPath.length - 2];
13231
- }
13232
- }
13233
- if (node.type === 13) {
13234
- if (parentCall) {
13235
- parentCall.arguments[0] = propsWithInjection;
13236
- } else {
13237
- node.props = propsWithInjection;
13238
- }
13239
- } else {
13240
- if (parentCall) {
13241
- parentCall.arguments[0] = propsWithInjection;
13242
- } else {
13243
- node.arguments[2] = propsWithInjection;
13244
- }
13245
- }
13246
- }
13247
- function hasProp(prop, props) {
13248
- let result = false;
13249
- if (prop.key.type === 4) {
13250
- const propKeyName = prop.key.content;
13251
- result = props.properties.some(
13252
- (p) => p.key.type === 4 && p.key.content === propKeyName
13253
- );
13254
- }
13255
- return result;
13256
- }
13257
- function toValidAssetId(name, type) {
13258
- return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13259
- return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13260
- })}`;
13261
- }
13262
- function getMemoedVNodeCall(node) {
13263
- if (node.type === 14 && node.callee === WITH_MEMO) {
13264
- return node.arguments[1].returns;
13265
- } else {
13266
- return node;
13267
- }
13268
- }
13269
-
13270
- const deprecationData = {
13271
- ["COMPILER_IS_ON_ELEMENT"]: {
13272
- message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
13273
- link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13274
- },
13275
- ["COMPILER_V_BIND_SYNC"]: {
13276
- message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
13277
- link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13278
- },
13279
- ["COMPILER_V_BIND_PROP"]: {
13280
- message: `.prop modifier for v-bind has been removed and no longer necessary. Vue 3 will automatically set a binding as DOM property when appropriate.`
13281
- },
13282
- ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13283
- message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
13284
- link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13285
- },
13286
- ["COMPILER_V_ON_NATIVE"]: {
13287
- message: `.native modifier for v-on has been removed as is no longer necessary.`,
13288
- link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13289
- },
13290
- ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13291
- message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
13292
- link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13293
- },
13294
- ["COMPILER_NATIVE_TEMPLATE"]: {
13295
- message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13296
- },
13297
- ["COMPILER_INLINE_TEMPLATE"]: {
13298
- message: `"inline-template" has been removed in Vue 3.`,
13299
- link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13300
- },
13301
- ["COMPILER_FILTER"]: {
13302
- message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
13303
- link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13304
- }
13305
- };
13306
- function getCompatValue(key, context) {
13307
- const config = context.options ? context.options.compatConfig : context.compatConfig;
13308
- const value = config && config[key];
13309
- if (key === "MODE") {
13310
- return value || 3;
14100
+ }
14101
+ }
14102
+ if (node.type === 13) {
14103
+ if (parentCall) {
14104
+ parentCall.arguments[0] = propsWithInjection;
14105
+ } else {
14106
+ node.props = propsWithInjection;
14107
+ }
13311
14108
  } else {
13312
- return value;
14109
+ if (parentCall) {
14110
+ parentCall.arguments[0] = propsWithInjection;
14111
+ } else {
14112
+ node.arguments[2] = propsWithInjection;
14113
+ }
13313
14114
  }
13314
14115
  }
13315
- function isCompatEnabled(key, context) {
13316
- const mode = getCompatValue("MODE", context);
13317
- const value = getCompatValue(key, context);
13318
- return mode === 3 ? value === true : value !== false;
13319
- }
13320
- function checkCompatEnabled(key, context, loc, ...args) {
13321
- const enabled = isCompatEnabled(key, context);
13322
- if (enabled) {
13323
- warnDeprecation(key, context, loc, ...args);
14116
+ function hasProp(prop, props) {
14117
+ let result = false;
14118
+ if (prop.key.type === 4) {
14119
+ const propKeyName = prop.key.content;
14120
+ result = props.properties.some(
14121
+ (p) => p.key.type === 4 && p.key.content === propKeyName
14122
+ );
13324
14123
  }
13325
- return enabled;
14124
+ return result;
13326
14125
  }
13327
- function warnDeprecation(key, context, loc, ...args) {
13328
- const val = getCompatValue(key, context);
13329
- if (val === "suppress-warning") {
13330
- return;
14126
+ function toValidAssetId(name, type) {
14127
+ return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
14128
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
14129
+ })}`;
14130
+ }
14131
+ function getMemoedVNodeCall(node) {
14132
+ if (node.type === 14 && node.callee === WITH_MEMO) {
14133
+ return node.arguments[1].returns;
14134
+ } else {
14135
+ return node;
13331
14136
  }
13332
- const { message, link } = deprecationData[key];
13333
- const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13334
- Details: ${link}` : ``}`;
13335
- const err = new SyntaxError(msg);
13336
- err.code = key;
13337
- if (loc)
13338
- err.loc = loc;
13339
- context.onWarn(err);
13340
14137
  }
14138
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13341
14139
 
13342
- const decodeRE = /&(gt|lt|amp|apos|quot);/g;
13343
- const decodeMap = {
13344
- gt: ">",
13345
- lt: "<",
13346
- amp: "&",
13347
- apos: "'",
13348
- quot: '"'
13349
- };
13350
14140
  const defaultParserOptions = {
14141
+ parseMode: "base",
14142
+ ns: 0,
13351
14143
  delimiters: [`{{`, `}}`],
13352
14144
  getNamespace: () => 0,
13353
- getTextMode: () => 0,
13354
14145
  isVoidTag: NO,
13355
14146
  isPreTag: NO,
13356
14147
  isCustomElement: NO,
13357
- decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
13358
14148
  onError: defaultOnError,
13359
14149
  onWarn: defaultOnWarn,
13360
14150
  comments: true
13361
14151
  };
13362
- function baseParse(content, options = {}) {
13363
- const context = createParserContext(content, options);
13364
- const start = getCursor(context);
13365
- return createRoot(
13366
- parseChildren(context, 0, []),
13367
- getSelection(context, start)
13368
- );
13369
- }
13370
- function createParserContext(content, rawOptions) {
13371
- const options = extend({}, defaultParserOptions);
13372
- let key;
13373
- for (key in rawOptions) {
13374
- options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
13375
- }
13376
- return {
13377
- options,
13378
- column: 1,
13379
- line: 1,
13380
- offset: 0,
13381
- originalSource: content,
13382
- source: content,
13383
- inPre: false,
13384
- inVPre: false,
13385
- onWarn: options.onWarn
13386
- };
13387
- }
13388
- function parseChildren(context, mode, ancestors) {
13389
- const parent = last(ancestors);
13390
- const ns = parent ? parent.ns : 0;
13391
- const nodes = [];
13392
- while (!isEnd(context, mode, ancestors)) {
13393
- const s = context.source;
13394
- let node = void 0;
13395
- if (mode === 0 || mode === 1) {
13396
- if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
13397
- node = parseInterpolation(context, mode);
13398
- } else if (mode === 0 && s[0] === "<") {
13399
- if (s.length === 1) {
13400
- emitError(context, 5, 1);
13401
- } else if (s[1] === "!") {
13402
- if (startsWith(s, "<!--")) {
13403
- node = parseComment(context);
13404
- } else if (startsWith(s, "<!DOCTYPE")) {
13405
- node = parseBogusComment(context);
13406
- } else if (startsWith(s, "<![CDATA[")) {
13407
- if (ns !== 0) {
13408
- node = parseCDATA(context, ancestors);
13409
- } else {
13410
- emitError(context, 1);
13411
- node = parseBogusComment(context);
13412
- }
13413
- } else {
13414
- emitError(context, 11);
13415
- node = parseBogusComment(context);
14152
+ let currentOptions = defaultParserOptions;
14153
+ let currentRoot = null;
14154
+ let currentInput = "";
14155
+ let currentOpenTag = null;
14156
+ let currentProp = null;
14157
+ let currentAttrValue = "";
14158
+ let currentAttrStartIndex = -1;
14159
+ let currentAttrEndIndex = -1;
14160
+ let inPre = 0;
14161
+ let inVPre = false;
14162
+ let currentVPreBoundary = null;
14163
+ const stack = [];
14164
+ const tokenizer = new Tokenizer(stack, {
14165
+ onerr: emitError,
14166
+ ontext(start, end) {
14167
+ onText(getSlice(start, end), start, end);
14168
+ },
14169
+ ontextentity(char, start, end) {
14170
+ onText(char, start, end);
14171
+ },
14172
+ oninterpolation(start, end) {
14173
+ if (inVPre) {
14174
+ return onText(getSlice(start, end), start, end);
14175
+ }
14176
+ let innerStart = start + tokenizer.delimiterOpen.length;
14177
+ let innerEnd = end - tokenizer.delimiterClose.length;
14178
+ while (isWhitespace(currentInput.charCodeAt(innerStart))) {
14179
+ innerStart++;
14180
+ }
14181
+ while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
14182
+ innerEnd--;
14183
+ }
14184
+ let exp = getSlice(innerStart, innerEnd);
14185
+ if (exp.includes("&")) {
14186
+ {
14187
+ exp = currentOptions.decodeEntities(exp, false);
14188
+ }
14189
+ }
14190
+ addNode({
14191
+ type: 5,
14192
+ content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
14193
+ loc: getLoc(start, end)
14194
+ });
14195
+ },
14196
+ onopentagname(start, end) {
14197
+ const name = getSlice(start, end);
14198
+ currentOpenTag = {
14199
+ type: 1,
14200
+ tag: name,
14201
+ ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
14202
+ tagType: 0,
14203
+ // will be refined on tag close
14204
+ props: [],
14205
+ children: [],
14206
+ loc: getLoc(start - 1, end),
14207
+ codegenNode: void 0
14208
+ };
14209
+ if (tokenizer.inSFCRoot) {
14210
+ currentOpenTag.innerLoc = getLoc(
14211
+ end + fastForward(end) + 1,
14212
+ end
14213
+ );
14214
+ }
14215
+ },
14216
+ onopentagend(end) {
14217
+ endOpenTag(end);
14218
+ },
14219
+ onclosetag(start, end) {
14220
+ const name = getSlice(start, end);
14221
+ if (!currentOptions.isVoidTag(name)) {
14222
+ let found = false;
14223
+ for (let i = 0; i < stack.length; i++) {
14224
+ const e = stack[i];
14225
+ if (e.tag.toLowerCase() === name.toLowerCase()) {
14226
+ found = true;
14227
+ if (i > 0) {
14228
+ emitError(24, stack[0].loc.start.offset);
13416
14229
  }
13417
- } else if (s[1] === "/") {
13418
- if (s.length === 2) {
13419
- emitError(context, 5, 2);
13420
- } else if (s[2] === ">") {
13421
- emitError(context, 14, 2);
13422
- advanceBy(context, 3);
13423
- continue;
13424
- } else if (/[a-z]/i.test(s[2])) {
13425
- emitError(context, 23);
13426
- parseTag(context, 1 /* End */, parent);
13427
- continue;
13428
- } else {
13429
- emitError(
13430
- context,
13431
- 12,
13432
- 2
13433
- );
13434
- node = parseBogusComment(context);
14230
+ for (let j = 0; j <= i; j++) {
14231
+ const el = stack.shift();
14232
+ onCloseTag(el, end, j < i);
13435
14233
  }
13436
- } else if (/[a-z]/i.test(s[1])) {
13437
- node = parseElement(context, ancestors);
13438
- if (isCompatEnabled(
13439
- "COMPILER_NATIVE_TEMPLATE",
13440
- context
13441
- ) && node && node.tag === "template" && !node.props.some(
13442
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13443
- )) {
13444
- warnDeprecation(
13445
- "COMPILER_NATIVE_TEMPLATE",
13446
- context,
13447
- node.loc
13448
- );
13449
- node = node.children;
14234
+ break;
14235
+ }
14236
+ }
14237
+ if (!found) {
14238
+ emitError(23, backTrack(start, 60));
14239
+ }
14240
+ }
14241
+ },
14242
+ onselfclosingtag(end) {
14243
+ var _a;
14244
+ const name = currentOpenTag.tag;
14245
+ currentOpenTag.isSelfClosing = true;
14246
+ endOpenTag(end);
14247
+ if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14248
+ onCloseTag(stack.shift(), end);
14249
+ }
14250
+ },
14251
+ onattribname(start, end) {
14252
+ currentProp = {
14253
+ type: 6,
14254
+ name: getSlice(start, end),
14255
+ nameLoc: getLoc(start, end),
14256
+ value: void 0,
14257
+ loc: getLoc(start)
14258
+ };
14259
+ },
14260
+ ondirname(start, end) {
14261
+ const raw = getSlice(start, end);
14262
+ const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
14263
+ if (!inVPre && name === "") {
14264
+ emitError(26, start);
14265
+ }
14266
+ if (inVPre || name === "") {
14267
+ currentProp = {
14268
+ type: 6,
14269
+ name: raw,
14270
+ nameLoc: getLoc(start, end),
14271
+ value: void 0,
14272
+ loc: getLoc(start)
14273
+ };
14274
+ } else {
14275
+ currentProp = {
14276
+ type: 7,
14277
+ name,
14278
+ rawName: raw,
14279
+ exp: void 0,
14280
+ arg: void 0,
14281
+ modifiers: raw === "." ? ["prop"] : [],
14282
+ loc: getLoc(start)
14283
+ };
14284
+ if (name === "pre") {
14285
+ inVPre = true;
14286
+ currentVPreBoundary = currentOpenTag;
14287
+ const props = currentOpenTag.props;
14288
+ for (let i = 0; i < props.length; i++) {
14289
+ if (props[i].type === 7) {
14290
+ props[i] = dirToAttr(props[i]);
13450
14291
  }
13451
- } else if (s[1] === "?") {
13452
- emitError(
13453
- context,
13454
- 21,
13455
- 1
13456
- );
13457
- node = parseBogusComment(context);
13458
- } else {
13459
- emitError(context, 12, 1);
13460
14292
  }
13461
14293
  }
13462
14294
  }
13463
- if (!node) {
13464
- node = parseText(context, mode);
14295
+ },
14296
+ ondirarg(start, end) {
14297
+ const arg = getSlice(start, end);
14298
+ if (inVPre) {
14299
+ currentProp.name += arg;
14300
+ setLocEnd(currentProp.nameLoc, end);
14301
+ } else {
14302
+ const isStatic = arg[0] !== `[`;
14303
+ currentProp.arg = createSimpleExpression(
14304
+ isStatic ? arg : arg.slice(1, -1),
14305
+ isStatic,
14306
+ getLoc(start, end),
14307
+ isStatic ? 3 : 0
14308
+ );
13465
14309
  }
13466
- if (isArray(node)) {
13467
- for (let i = 0; i < node.length; i++) {
13468
- pushNode(nodes, node[i]);
14310
+ },
14311
+ ondirmodifier(start, end) {
14312
+ const mod = getSlice(start, end);
14313
+ if (inVPre) {
14314
+ currentProp.name += "." + mod;
14315
+ setLocEnd(currentProp.nameLoc, end);
14316
+ } else if (currentProp.name === "slot") {
14317
+ const arg = currentProp.arg;
14318
+ if (arg) {
14319
+ arg.content += "." + mod;
14320
+ setLocEnd(arg.loc, end);
13469
14321
  }
13470
14322
  } else {
13471
- pushNode(nodes, node);
14323
+ currentProp.modifiers.push(mod);
13472
14324
  }
13473
- }
13474
- let removedWhitespace = false;
13475
- if (mode !== 2 && mode !== 1) {
13476
- const shouldCondense = context.options.whitespace !== "preserve";
13477
- for (let i = 0; i < nodes.length; i++) {
13478
- const node = nodes[i];
13479
- if (node.type === 2) {
13480
- if (!context.inPre) {
13481
- if (!/[^\t\r\n\f ]/.test(node.content)) {
13482
- const prev = nodes[i - 1];
13483
- const next = nodes[i + 1];
13484
- if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
13485
- removedWhitespace = true;
13486
- nodes[i] = null;
13487
- } else {
13488
- node.content = " ";
13489
- }
13490
- } else if (shouldCondense) {
13491
- node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
14325
+ },
14326
+ onattribdata(start, end) {
14327
+ currentAttrValue += getSlice(start, end);
14328
+ if (currentAttrStartIndex < 0)
14329
+ currentAttrStartIndex = start;
14330
+ currentAttrEndIndex = end;
14331
+ },
14332
+ onattribentity(char, start, end) {
14333
+ currentAttrValue += char;
14334
+ if (currentAttrStartIndex < 0)
14335
+ currentAttrStartIndex = start;
14336
+ currentAttrEndIndex = end;
14337
+ },
14338
+ onattribnameend(end) {
14339
+ const start = currentProp.loc.start.offset;
14340
+ const name = getSlice(start, end);
14341
+ if (currentProp.type === 7) {
14342
+ currentProp.rawName = name;
14343
+ }
14344
+ if (currentOpenTag.props.some(
14345
+ (p) => (p.type === 7 ? p.rawName : p.name) === name
14346
+ )) {
14347
+ emitError(2, start);
14348
+ }
14349
+ },
14350
+ onattribend(quote, end) {
14351
+ if (currentOpenTag && currentProp) {
14352
+ setLocEnd(currentProp.loc, end);
14353
+ if (quote !== 0) {
14354
+ if (currentAttrValue.includes("&")) {
14355
+ currentAttrValue = currentOptions.decodeEntities(
14356
+ currentAttrValue,
14357
+ true
14358
+ );
14359
+ }
14360
+ if (currentProp.type === 6) {
14361
+ if (currentProp.name === "class") {
14362
+ currentAttrValue = condense(currentAttrValue).trim();
14363
+ }
14364
+ if (quote === 1 && !currentAttrValue) {
14365
+ emitError(13, end);
14366
+ }
14367
+ currentProp.value = {
14368
+ type: 2,
14369
+ content: currentAttrValue,
14370
+ loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
14371
+ };
14372
+ if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
14373
+ tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
13492
14374
  }
13493
14375
  } else {
13494
- node.content = node.content.replace(/\r\n/g, "\n");
14376
+ currentProp.exp = createSimpleExpression(
14377
+ currentAttrValue,
14378
+ false,
14379
+ getLoc(currentAttrStartIndex, currentAttrEndIndex)
14380
+ );
14381
+ if (currentProp.name === "for") {
14382
+ currentProp.forParseResult = parseForExpression(currentProp.exp);
14383
+ }
14384
+ let syncIndex = -1;
14385
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
14386
+ "COMPILER_V_BIND_SYNC",
14387
+ currentOptions,
14388
+ currentProp.loc,
14389
+ currentProp.rawName
14390
+ )) {
14391
+ currentProp.name = "model";
14392
+ currentProp.modifiers.splice(syncIndex, 1);
14393
+ }
13495
14394
  }
13496
- } else if (node.type === 3 && !context.options.comments) {
13497
- removedWhitespace = true;
13498
- nodes[i] = null;
13499
14395
  }
14396
+ if (currentProp.type !== 7 || currentProp.name !== "pre") {
14397
+ currentOpenTag.props.push(currentProp);
14398
+ }
14399
+ }
14400
+ currentAttrValue = "";
14401
+ currentAttrStartIndex = currentAttrEndIndex = -1;
14402
+ },
14403
+ oncomment(start, end) {
14404
+ if (currentOptions.comments) {
14405
+ addNode({
14406
+ type: 3,
14407
+ content: getSlice(start, end),
14408
+ loc: getLoc(start - 4, end + 3)
14409
+ });
13500
14410
  }
13501
- if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
13502
- const first = nodes[0];
13503
- if (first && first.type === 2) {
13504
- first.content = first.content.replace(/^\r?\n/, "");
14411
+ },
14412
+ onend() {
14413
+ const end = currentInput.length;
14414
+ if (tokenizer.state !== 1) {
14415
+ switch (tokenizer.state) {
14416
+ case 5:
14417
+ case 8:
14418
+ emitError(5, end);
14419
+ break;
14420
+ case 3:
14421
+ case 4:
14422
+ emitError(
14423
+ 25,
14424
+ tokenizer.sectionStart
14425
+ );
14426
+ break;
14427
+ case 28:
14428
+ if (tokenizer.currentSequence === Sequences.CdataEnd) {
14429
+ emitError(6, end);
14430
+ } else {
14431
+ emitError(7, end);
14432
+ }
14433
+ break;
14434
+ case 6:
14435
+ case 7:
14436
+ case 9:
14437
+ case 11:
14438
+ case 12:
14439
+ case 13:
14440
+ case 14:
14441
+ case 15:
14442
+ case 16:
14443
+ case 17:
14444
+ case 18:
14445
+ case 19:
14446
+ case 20:
14447
+ case 21:
14448
+ emitError(9, end);
14449
+ break;
13505
14450
  }
13506
14451
  }
13507
- }
13508
- return removedWhitespace ? nodes.filter(Boolean) : nodes;
13509
- }
13510
- function pushNode(nodes, node) {
13511
- if (node.type === 2) {
13512
- const prev = last(nodes);
13513
- if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
13514
- prev.content += node.content;
13515
- prev.loc.end = node.loc.end;
13516
- prev.loc.source += node.loc.source;
13517
- return;
14452
+ for (let index = 0; index < stack.length; index++) {
14453
+ onCloseTag(stack[index], end - 1);
14454
+ emitError(24, stack[index].loc.start.offset);
13518
14455
  }
13519
- }
13520
- nodes.push(node);
13521
- }
13522
- function parseCDATA(context, ancestors) {
13523
- advanceBy(context, 9);
13524
- const nodes = parseChildren(context, 3, ancestors);
13525
- if (context.source.length === 0) {
13526
- emitError(context, 6);
13527
- } else {
13528
- advanceBy(context, 3);
13529
- }
13530
- return nodes;
13531
- }
13532
- function parseComment(context) {
13533
- const start = getCursor(context);
13534
- let content;
13535
- const match = /--(\!)?>/.exec(context.source);
13536
- if (!match) {
13537
- content = context.source.slice(4);
13538
- advanceBy(context, context.source.length);
13539
- emitError(context, 7);
13540
- } else {
13541
- if (match.index <= 3) {
13542
- emitError(context, 0);
14456
+ },
14457
+ oncdata(start, end) {
14458
+ if (stack[0].ns !== 0) {
14459
+ onText(getSlice(start, end), start, end);
14460
+ } else {
14461
+ emitError(1, start - 9);
14462
+ }
14463
+ },
14464
+ onprocessinginstruction(start) {
14465
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14466
+ emitError(
14467
+ 21,
14468
+ start - 1
14469
+ );
13543
14470
  }
13544
- if (match[1]) {
13545
- emitError(context, 10);
14471
+ }
14472
+ });
14473
+ const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14474
+ const stripParensRE = /^\(|\)$/g;
14475
+ function parseForExpression(input) {
14476
+ const loc = input.loc;
14477
+ const exp = input.content;
14478
+ const inMatch = exp.match(forAliasRE);
14479
+ if (!inMatch)
14480
+ return;
14481
+ const [, LHS, RHS] = inMatch;
14482
+ const createAliasExpression = (content, offset) => {
14483
+ const start = loc.start.offset + offset;
14484
+ const end = start + content.length;
14485
+ return createSimpleExpression(content, false, getLoc(start, end));
14486
+ };
14487
+ const result = {
14488
+ source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14489
+ value: void 0,
14490
+ key: void 0,
14491
+ index: void 0,
14492
+ finalized: false
14493
+ };
14494
+ let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14495
+ const trimmedOffset = LHS.indexOf(valueContent);
14496
+ const iteratorMatch = valueContent.match(forIteratorRE);
14497
+ if (iteratorMatch) {
14498
+ valueContent = valueContent.replace(forIteratorRE, "").trim();
14499
+ const keyContent = iteratorMatch[1].trim();
14500
+ let keyOffset;
14501
+ if (keyContent) {
14502
+ keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14503
+ result.key = createAliasExpression(keyContent, keyOffset);
13546
14504
  }
13547
- content = context.source.slice(4, match.index);
13548
- const s = context.source.slice(0, match.index);
13549
- let prevIndex = 1, nestedIndex = 0;
13550
- while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
13551
- advanceBy(context, nestedIndex - prevIndex + 1);
13552
- if (nestedIndex + 4 < s.length) {
13553
- emitError(context, 16);
14505
+ if (iteratorMatch[2]) {
14506
+ const indexContent = iteratorMatch[2].trim();
14507
+ if (indexContent) {
14508
+ result.index = createAliasExpression(
14509
+ indexContent,
14510
+ exp.indexOf(
14511
+ indexContent,
14512
+ result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14513
+ )
14514
+ );
13554
14515
  }
13555
- prevIndex = nestedIndex + 1;
13556
14516
  }
13557
- advanceBy(context, match.index + match[0].length - prevIndex + 1);
13558
14517
  }
13559
- return {
13560
- type: 3,
13561
- content,
13562
- loc: getSelection(context, start)
13563
- };
14518
+ if (valueContent) {
14519
+ result.value = createAliasExpression(valueContent, trimmedOffset);
14520
+ }
14521
+ return result;
14522
+ }
14523
+ function getSlice(start, end) {
14524
+ return currentInput.slice(start, end);
13564
14525
  }
13565
- function parseBogusComment(context) {
13566
- const start = getCursor(context);
13567
- const contentStart = context.source[1] === "?" ? 1 : 2;
13568
- let content;
13569
- const closeIndex = context.source.indexOf(">");
13570
- if (closeIndex === -1) {
13571
- content = context.source.slice(contentStart);
13572
- advanceBy(context, context.source.length);
14526
+ function endOpenTag(end) {
14527
+ addNode(currentOpenTag);
14528
+ const { tag, ns } = currentOpenTag;
14529
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14530
+ inPre++;
14531
+ }
14532
+ if (currentOptions.isVoidTag(tag)) {
14533
+ onCloseTag(currentOpenTag, end);
13573
14534
  } else {
13574
- content = context.source.slice(contentStart, closeIndex);
13575
- advanceBy(context, closeIndex + 1);
14535
+ stack.unshift(currentOpenTag);
14536
+ if (ns === 1 || ns === 2) {
14537
+ tokenizer.inXML = true;
14538
+ }
13576
14539
  }
13577
- return {
13578
- type: 3,
13579
- content,
13580
- loc: getSelection(context, start)
13581
- };
14540
+ currentOpenTag = null;
13582
14541
  }
13583
- function parseElement(context, ancestors) {
13584
- const wasInPre = context.inPre;
13585
- const wasInVPre = context.inVPre;
13586
- const parent = last(ancestors);
13587
- const element = parseTag(context, 0 /* Start */, parent);
13588
- const isPreBoundary = context.inPre && !wasInPre;
13589
- const isVPreBoundary = context.inVPre && !wasInVPre;
13590
- if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
13591
- if (isPreBoundary) {
13592
- context.inPre = false;
13593
- }
13594
- if (isVPreBoundary) {
13595
- context.inVPre = false;
13596
- }
13597
- return element;
13598
- }
13599
- ancestors.push(element);
13600
- const mode = context.options.getTextMode(element, parent);
13601
- const children = parseChildren(context, mode, ancestors);
13602
- ancestors.pop();
14542
+ function onText(content, start, end) {
14543
+ var _a;
13603
14544
  {
13604
- const inlineTemplateProp = element.props.find(
13605
- (p) => p.type === 6 && p.name === "inline-template"
13606
- );
13607
- if (inlineTemplateProp && checkCompatEnabled(
13608
- "COMPILER_INLINE_TEMPLATE",
13609
- context,
13610
- inlineTemplateProp.loc
13611
- )) {
13612
- const loc = getSelection(context, element.loc.end);
13613
- inlineTemplateProp.value = {
13614
- type: 2,
13615
- content: loc.source,
13616
- loc
13617
- };
14545
+ const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
14546
+ if (tag !== "script" && tag !== "style" && content.includes("&")) {
14547
+ content = currentOptions.decodeEntities(content, false);
13618
14548
  }
13619
14549
  }
13620
- element.children = children;
13621
- if (startsWithEndTagOpen(context.source, element.tag)) {
13622
- parseTag(context, 1 /* End */, parent);
14550
+ const parent = stack[0] || currentRoot;
14551
+ const lastNode = parent.children[parent.children.length - 1];
14552
+ if ((lastNode == null ? void 0 : lastNode.type) === 2) {
14553
+ lastNode.content += content;
14554
+ setLocEnd(lastNode.loc, end);
13623
14555
  } else {
13624
- emitError(context, 24, 0, element.loc.start);
13625
- if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
13626
- const first = children[0];
13627
- if (first && startsWith(first.loc.source, "<!--")) {
13628
- emitError(context, 8);
13629
- }
14556
+ parent.children.push({
14557
+ type: 2,
14558
+ content,
14559
+ loc: getLoc(start, end)
14560
+ });
14561
+ }
14562
+ }
14563
+ function onCloseTag(el, end, isImplied = false) {
14564
+ if (isImplied) {
14565
+ setLocEnd(el.loc, backTrack(end, 60));
14566
+ } else {
14567
+ setLocEnd(el.loc, end + fastForward(end) + 1);
14568
+ }
14569
+ if (tokenizer.inSFCRoot) {
14570
+ if (el.children.length) {
14571
+ el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14572
+ } else {
14573
+ el.innerLoc.end = extend({}, el.innerLoc.start);
14574
+ }
14575
+ el.innerLoc.source = getSlice(
14576
+ el.innerLoc.start.offset,
14577
+ el.innerLoc.end.offset
14578
+ );
14579
+ }
14580
+ const { tag, ns } = el;
14581
+ if (!inVPre) {
14582
+ if (tag === "slot") {
14583
+ el.tagType = 2;
14584
+ } else if (isFragmentTemplate(el)) {
14585
+ el.tagType = 3;
14586
+ } else if (isComponent(el)) {
14587
+ el.tagType = 1;
13630
14588
  }
13631
14589
  }
13632
- element.loc = getSelection(context, element.loc.start);
13633
- if (isPreBoundary) {
13634
- context.inPre = false;
14590
+ if (!tokenizer.inRCDATA) {
14591
+ el.children = condenseWhitespace(el.children, el.tag);
13635
14592
  }
13636
- if (isVPreBoundary) {
13637
- context.inVPre = false;
14593
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14594
+ inPre--;
13638
14595
  }
13639
- return element;
13640
- }
13641
- const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
13642
- `if,else,else-if,for,slot`
13643
- );
13644
- function parseTag(context, type, parent) {
13645
- const start = getCursor(context);
13646
- const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
13647
- const tag = match[1];
13648
- const ns = context.options.getNamespace(tag, parent);
13649
- advanceBy(context, match[0].length);
13650
- advanceSpaces(context);
13651
- const cursor = getCursor(context);
13652
- const currentSource = context.source;
13653
- if (context.options.isPreTag(tag)) {
13654
- context.inPre = true;
13655
- }
13656
- let props = parseAttributes(context, type);
13657
- if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
13658
- context.inVPre = true;
13659
- extend(context, cursor);
13660
- context.source = currentSource;
13661
- props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
13662
- }
13663
- let isSelfClosing = false;
13664
- if (context.source.length === 0) {
13665
- emitError(context, 9);
13666
- } else {
13667
- isSelfClosing = startsWith(context.source, "/>");
13668
- if (type === 1 /* End */ && isSelfClosing) {
13669
- emitError(context, 4);
14596
+ if (currentVPreBoundary === el) {
14597
+ inVPre = false;
14598
+ currentVPreBoundary = null;
14599
+ }
14600
+ if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14601
+ tokenizer.inXML = false;
14602
+ }
14603
+ {
14604
+ const props = el.props;
14605
+ if (isCompatEnabled(
14606
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14607
+ currentOptions
14608
+ )) {
14609
+ let hasIf = false;
14610
+ let hasFor = false;
14611
+ for (let i = 0; i < props.length; i++) {
14612
+ const p = props[i];
14613
+ if (p.type === 7) {
14614
+ if (p.name === "if") {
14615
+ hasIf = true;
14616
+ } else if (p.name === "for") {
14617
+ hasFor = true;
14618
+ }
14619
+ }
14620
+ if (hasIf && hasFor) {
14621
+ warnDeprecation(
14622
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14623
+ currentOptions,
14624
+ el.loc
14625
+ );
14626
+ break;
14627
+ }
14628
+ }
14629
+ }
14630
+ if (isCompatEnabled(
14631
+ "COMPILER_NATIVE_TEMPLATE",
14632
+ currentOptions
14633
+ ) && el.tag === "template" && !isFragmentTemplate(el)) {
14634
+ warnDeprecation(
14635
+ "COMPILER_NATIVE_TEMPLATE",
14636
+ currentOptions,
14637
+ el.loc
14638
+ );
14639
+ const parent = stack[0] || currentRoot;
14640
+ const index = parent.children.indexOf(el);
14641
+ parent.children.splice(index, 1, ...el.children);
14642
+ }
14643
+ const inlineTemplateProp = props.find(
14644
+ (p) => p.type === 6 && p.name === "inline-template"
14645
+ );
14646
+ if (inlineTemplateProp && checkCompatEnabled(
14647
+ "COMPILER_INLINE_TEMPLATE",
14648
+ currentOptions,
14649
+ inlineTemplateProp.loc
14650
+ ) && el.children.length) {
14651
+ inlineTemplateProp.value = {
14652
+ type: 2,
14653
+ content: getSlice(
14654
+ el.children[0].loc.start.offset,
14655
+ el.children[el.children.length - 1].loc.end.offset
14656
+ ),
14657
+ loc: inlineTemplateProp.loc
14658
+ };
13670
14659
  }
13671
- advanceBy(context, isSelfClosing ? 2 : 1);
13672
14660
  }
13673
- if (type === 1 /* End */) {
13674
- return;
14661
+ }
14662
+ function fastForward(start, c) {
14663
+ let offset = 0;
14664
+ while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
14665
+ offset++;
13675
14666
  }
13676
- if (isCompatEnabled(
13677
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13678
- context
13679
- )) {
13680
- let hasIf = false;
13681
- let hasFor = false;
14667
+ return offset;
14668
+ }
14669
+ function backTrack(index, c) {
14670
+ let i = index;
14671
+ while (currentInput.charCodeAt(i) !== c && i >= 0)
14672
+ i--;
14673
+ return i;
14674
+ }
14675
+ const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14676
+ function isFragmentTemplate({ tag, props }) {
14677
+ if (tag === "template") {
13682
14678
  for (let i = 0; i < props.length; i++) {
13683
- const p = props[i];
13684
- if (p.type === 7) {
13685
- if (p.name === "if") {
13686
- hasIf = true;
13687
- } else if (p.name === "for") {
13688
- hasFor = true;
13689
- }
13690
- }
13691
- if (hasIf && hasFor) {
13692
- warnDeprecation(
13693
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13694
- context,
13695
- getSelection(context, start)
13696
- );
13697
- break;
13698
- }
13699
- }
13700
- }
13701
- let tagType = 0;
13702
- if (!context.inVPre) {
13703
- if (tag === "slot") {
13704
- tagType = 2;
13705
- } else if (tag === "template") {
13706
- if (props.some(
13707
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13708
- )) {
13709
- tagType = 3;
14679
+ if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14680
+ return true;
13710
14681
  }
13711
- } else if (isComponent(tag, props, context)) {
13712
- tagType = 1;
13713
14682
  }
13714
14683
  }
13715
- return {
13716
- type: 1,
13717
- ns,
13718
- tag,
13719
- tagType,
13720
- props,
13721
- isSelfClosing,
13722
- children: [],
13723
- loc: getSelection(context, start),
13724
- codegenNode: void 0
13725
- // to be created during transform phase
13726
- };
14684
+ return false;
13727
14685
  }
13728
- function isComponent(tag, props, context) {
13729
- const options = context.options;
13730
- if (options.isCustomElement(tag)) {
14686
+ function isComponent({ tag, props }) {
14687
+ var _a;
14688
+ if (currentOptions.isCustomElement(tag)) {
13731
14689
  return false;
13732
14690
  }
13733
- if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
14691
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13734
14692
  return true;
13735
14693
  }
13736
14694
  for (let i = 0; i < props.length; i++) {
@@ -13741,374 +14699,179 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13741
14699
  return true;
13742
14700
  } else if (checkCompatEnabled(
13743
14701
  "COMPILER_IS_ON_ELEMENT",
13744
- context,
14702
+ currentOptions,
13745
14703
  p.loc
13746
14704
  )) {
13747
14705
  return true;
13748
14706
  }
13749
14707
  }
13750
- } else {
13751
- if (p.name === "is") {
13752
- return true;
13753
- } else if (
13754
- // :is on plain element - only treat as component in compat mode
13755
- p.name === "bind" && isStaticArgOf(p.arg, "is") && true && checkCompatEnabled(
13756
- "COMPILER_IS_ON_ELEMENT",
13757
- context,
13758
- p.loc
13759
- )
13760
- ) {
13761
- return true;
13762
- }
14708
+ } else if (// :is on plain element - only treat as component in compat mode
14709
+ p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
14710
+ "COMPILER_IS_ON_ELEMENT",
14711
+ currentOptions,
14712
+ p.loc
14713
+ )) {
14714
+ return true;
13763
14715
  }
13764
14716
  }
14717
+ return false;
13765
14718
  }
13766
- function parseAttributes(context, type) {
13767
- const props = [];
13768
- const attributeNames = /* @__PURE__ */ new Set();
13769
- while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
13770
- if (startsWith(context.source, "/")) {
13771
- emitError(context, 22);
13772
- advanceBy(context, 1);
13773
- advanceSpaces(context);
13774
- continue;
13775
- }
13776
- if (type === 1 /* End */) {
13777
- emitError(context, 3);
13778
- }
13779
- const attr = parseAttribute(context, attributeNames);
13780
- if (attr.type === 6 && attr.value && attr.name === "class") {
13781
- attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
13782
- }
13783
- if (type === 0 /* Start */) {
13784
- props.push(attr);
13785
- }
13786
- if (/^[^\t\r\n\f />]/.test(context.source)) {
13787
- emitError(context, 15);
13788
- }
13789
- advanceSpaces(context);
13790
- }
13791
- return props;
14719
+ function isUpperCase(c) {
14720
+ return c > 64 && c < 91;
13792
14721
  }
13793
- function parseAttribute(context, nameSet) {
13794
- var _a;
13795
- const start = getCursor(context);
13796
- const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
13797
- const name = match[0];
13798
- if (nameSet.has(name)) {
13799
- emitError(context, 2);
13800
- }
13801
- nameSet.add(name);
13802
- if (name[0] === "=") {
13803
- emitError(context, 19);
13804
- }
13805
- {
13806
- const pattern = /["'<]/g;
13807
- let m;
13808
- while (m = pattern.exec(name)) {
13809
- emitError(
13810
- context,
13811
- 17,
13812
- m.index
13813
- );
13814
- }
13815
- }
13816
- advanceBy(context, name.length);
13817
- let value = void 0;
13818
- if (/^[\t\r\n\f ]*=/.test(context.source)) {
13819
- advanceSpaces(context);
13820
- advanceBy(context, 1);
13821
- advanceSpaces(context);
13822
- value = parseAttributeValue(context);
13823
- if (!value) {
13824
- emitError(context, 13);
13825
- }
13826
- }
13827
- const loc = getSelection(context, start);
13828
- if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
13829
- const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
13830
- name
13831
- );
13832
- let isPropShorthand = startsWith(name, ".");
13833
- let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
13834
- let arg;
13835
- if (match2[2]) {
13836
- const isSlot = dirName === "slot";
13837
- const startOffset = name.lastIndexOf(
13838
- match2[2],
13839
- name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
13840
- );
13841
- const loc2 = getSelection(
13842
- context,
13843
- getNewPosition(context, start, startOffset),
13844
- getNewPosition(
13845
- context,
13846
- start,
13847
- startOffset + match2[2].length + (isSlot && match2[3] || "").length
13848
- )
13849
- );
13850
- let content = match2[2];
13851
- let isStatic = true;
13852
- if (content.startsWith("[")) {
13853
- isStatic = false;
13854
- if (!content.endsWith("]")) {
13855
- emitError(
13856
- context,
13857
- 27
13858
- );
13859
- content = content.slice(1);
13860
- } else {
13861
- content = content.slice(1, content.length - 1);
14722
+ const windowsNewlineRE = /\r\n/g;
14723
+ function condenseWhitespace(nodes, tag) {
14724
+ var _a, _b;
14725
+ const shouldCondense = currentOptions.whitespace !== "preserve";
14726
+ let removedWhitespace = false;
14727
+ for (let i = 0; i < nodes.length; i++) {
14728
+ const node = nodes[i];
14729
+ if (node.type === 2) {
14730
+ if (!inPre) {
14731
+ if (isAllWhitespace(node.content)) {
14732
+ const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
14733
+ const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
14734
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14735
+ removedWhitespace = true;
14736
+ nodes[i] = null;
14737
+ } else {
14738
+ node.content = " ";
14739
+ }
14740
+ } else if (shouldCondense) {
14741
+ node.content = condense(node.content);
13862
14742
  }
13863
- } else if (isSlot) {
13864
- content += match2[3] || "";
13865
- }
13866
- arg = {
13867
- type: 4,
13868
- content,
13869
- isStatic,
13870
- constType: isStatic ? 3 : 0,
13871
- loc: loc2
13872
- };
13873
- }
13874
- if (value && value.isQuoted) {
13875
- const valueLoc = value.loc;
13876
- valueLoc.start.offset++;
13877
- valueLoc.start.column++;
13878
- valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
13879
- valueLoc.source = valueLoc.source.slice(1, -1);
13880
- }
13881
- const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
13882
- if (isPropShorthand)
13883
- modifiers.push("prop");
13884
- if (dirName === "bind" && arg) {
13885
- if (modifiers.includes("sync") && checkCompatEnabled(
13886
- "COMPILER_V_BIND_SYNC",
13887
- context,
13888
- loc,
13889
- arg.loc.source
13890
- )) {
13891
- dirName = "model";
13892
- modifiers.splice(modifiers.indexOf("sync"), 1);
13893
- }
13894
- if (modifiers.includes("prop")) {
13895
- checkCompatEnabled(
13896
- "COMPILER_V_BIND_PROP",
13897
- context,
13898
- loc
13899
- );
14743
+ } else {
14744
+ node.content = node.content.replace(windowsNewlineRE, "\n");
13900
14745
  }
13901
14746
  }
13902
- return {
13903
- type: 7,
13904
- name: dirName,
13905
- exp: value && {
13906
- type: 4,
13907
- content: value.content,
13908
- isStatic: false,
13909
- // Treat as non-constant by default. This can be potentially set to
13910
- // other values by `transformExpression` to make it eligible for hoisting.
13911
- constType: 0,
13912
- loc: value.loc
13913
- },
13914
- arg,
13915
- modifiers,
13916
- loc
13917
- };
13918
14747
  }
13919
- if (!context.inVPre && startsWith(name, "v-")) {
13920
- emitError(context, 26);
14748
+ if (inPre && tag && currentOptions.isPreTag(tag)) {
14749
+ const first = nodes[0];
14750
+ if (first && first.type === 2) {
14751
+ first.content = first.content.replace(/^\r?\n/, "");
14752
+ }
13921
14753
  }
13922
- return {
13923
- type: 6,
13924
- name,
13925
- value: value && {
13926
- type: 2,
13927
- content: value.content,
13928
- loc: value.loc
13929
- },
13930
- loc
13931
- };
14754
+ return removedWhitespace ? nodes.filter(Boolean) : nodes;
13932
14755
  }
13933
- function parseAttributeValue(context) {
13934
- const start = getCursor(context);
13935
- let content;
13936
- const quote = context.source[0];
13937
- const isQuoted = quote === `"` || quote === `'`;
13938
- if (isQuoted) {
13939
- advanceBy(context, 1);
13940
- const endIndex = context.source.indexOf(quote);
13941
- if (endIndex === -1) {
13942
- content = parseTextData(
13943
- context,
13944
- context.source.length,
13945
- 4
13946
- );
13947
- } else {
13948
- content = parseTextData(context, endIndex, 4);
13949
- advanceBy(context, 1);
13950
- }
13951
- } else {
13952
- const match = /^[^\t\r\n\f >]+/.exec(context.source);
13953
- if (!match) {
13954
- return void 0;
13955
- }
13956
- const unexpectedChars = /["'<=`]/g;
13957
- let m;
13958
- while (m = unexpectedChars.exec(match[0])) {
13959
- emitError(
13960
- context,
13961
- 18,
13962
- m.index
13963
- );
14756
+ function isAllWhitespace(str) {
14757
+ for (let i = 0; i < str.length; i++) {
14758
+ if (!isWhitespace(str.charCodeAt(i))) {
14759
+ return false;
13964
14760
  }
13965
- content = parseTextData(context, match[0].length, 4);
13966
- }
13967
- return { content, isQuoted, loc: getSelection(context, start) };
13968
- }
13969
- function parseInterpolation(context, mode) {
13970
- const [open, close] = context.options.delimiters;
13971
- const closeIndex = context.source.indexOf(close, open.length);
13972
- if (closeIndex === -1) {
13973
- emitError(context, 25);
13974
- return void 0;
13975
- }
13976
- const start = getCursor(context);
13977
- advanceBy(context, open.length);
13978
- const innerStart = getCursor(context);
13979
- const innerEnd = getCursor(context);
13980
- const rawContentLength = closeIndex - open.length;
13981
- const rawContent = context.source.slice(0, rawContentLength);
13982
- const preTrimContent = parseTextData(context, rawContentLength, mode);
13983
- const content = preTrimContent.trim();
13984
- const startOffset = preTrimContent.indexOf(content);
13985
- if (startOffset > 0) {
13986
- advancePositionWithMutation(innerStart, rawContent, startOffset);
13987
- }
13988
- const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
13989
- advancePositionWithMutation(innerEnd, rawContent, endOffset);
13990
- advanceBy(context, close.length);
13991
- return {
13992
- type: 5,
13993
- content: {
13994
- type: 4,
13995
- isStatic: false,
13996
- // Set `isConstant` to false by default and will decide in transformExpression
13997
- constType: 0,
13998
- content,
13999
- loc: getSelection(context, innerStart, innerEnd)
14000
- },
14001
- loc: getSelection(context, start)
14002
- };
14761
+ }
14762
+ return true;
14003
14763
  }
14004
- function parseText(context, mode) {
14005
- const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
14006
- let endIndex = context.source.length;
14007
- for (let i = 0; i < endTokens.length; i++) {
14008
- const index = context.source.indexOf(endTokens[i], 1);
14009
- if (index !== -1 && endIndex > index) {
14010
- endIndex = index;
14764
+ function hasNewlineChar(str) {
14765
+ for (let i = 0; i < str.length; i++) {
14766
+ const c = str.charCodeAt(i);
14767
+ if (c === 10 || c === 13) {
14768
+ return true;
14011
14769
  }
14012
14770
  }
14013
- const start = getCursor(context);
14014
- const content = parseTextData(context, endIndex, mode);
14015
- return {
14016
- type: 2,
14017
- content,
14018
- loc: getSelection(context, start)
14019
- };
14771
+ return false;
14020
14772
  }
14021
- function parseTextData(context, length, mode) {
14022
- const rawText = context.source.slice(0, length);
14023
- advanceBy(context, length);
14024
- if (mode === 2 || mode === 3 || !rawText.includes("&")) {
14025
- return rawText;
14026
- } else {
14027
- return context.options.decodeEntities(
14028
- rawText,
14029
- mode === 4
14030
- );
14773
+ function condense(str) {
14774
+ let ret = "";
14775
+ let prevCharIsWhitespace = false;
14776
+ for (let i = 0; i < str.length; i++) {
14777
+ if (isWhitespace(str.charCodeAt(i))) {
14778
+ if (!prevCharIsWhitespace) {
14779
+ ret += " ";
14780
+ prevCharIsWhitespace = true;
14781
+ }
14782
+ } else {
14783
+ ret += str[i];
14784
+ prevCharIsWhitespace = false;
14785
+ }
14031
14786
  }
14787
+ return ret;
14032
14788
  }
14033
- function getCursor(context) {
14034
- const { column, line, offset } = context;
14035
- return { column, line, offset };
14789
+ function addNode(node) {
14790
+ (stack[0] || currentRoot).children.push(node);
14036
14791
  }
14037
- function getSelection(context, start, end) {
14038
- end = end || getCursor(context);
14792
+ function getLoc(start, end) {
14039
14793
  return {
14040
- start,
14041
- end,
14042
- source: context.originalSource.slice(start.offset, end.offset)
14794
+ start: tokenizer.getPos(start),
14795
+ // @ts-expect-error allow late attachment
14796
+ end: end == null ? end : tokenizer.getPos(end),
14797
+ // @ts-expect-error allow late attachment
14798
+ source: end == null ? end : getSlice(start, end)
14043
14799
  };
14044
14800
  }
14045
- function last(xs) {
14046
- return xs[xs.length - 1];
14047
- }
14048
- function startsWith(source, searchString) {
14049
- return source.startsWith(searchString);
14801
+ function setLocEnd(loc, end) {
14802
+ loc.end = tokenizer.getPos(end);
14803
+ loc.source = getSlice(loc.start.offset, end);
14050
14804
  }
14051
- function advanceBy(context, numberOfCharacters) {
14052
- const { source } = context;
14053
- advancePositionWithMutation(context, source, numberOfCharacters);
14054
- context.source = source.slice(numberOfCharacters);
14055
- }
14056
- function advanceSpaces(context) {
14057
- const match = /^[\t\r\n\f ]+/.exec(context.source);
14058
- if (match) {
14059
- advanceBy(context, match[0].length);
14805
+ function dirToAttr(dir) {
14806
+ const attr = {
14807
+ type: 6,
14808
+ name: dir.rawName,
14809
+ nameLoc: getLoc(
14810
+ dir.loc.start.offset,
14811
+ dir.loc.start.offset + dir.rawName.length
14812
+ ),
14813
+ value: void 0,
14814
+ loc: dir.loc
14815
+ };
14816
+ if (dir.exp) {
14817
+ const loc = dir.exp.loc;
14818
+ if (loc.end.offset < dir.loc.end.offset) {
14819
+ loc.start.offset--;
14820
+ loc.start.column--;
14821
+ loc.end.offset++;
14822
+ loc.end.column++;
14823
+ }
14824
+ attr.value = {
14825
+ type: 2,
14826
+ content: dir.exp.content,
14827
+ loc
14828
+ };
14060
14829
  }
14830
+ return attr;
14061
14831
  }
14062
- function getNewPosition(context, start, numberOfCharacters) {
14063
- return advancePositionWithClone(
14064
- start,
14065
- context.originalSource.slice(start.offset, numberOfCharacters),
14066
- numberOfCharacters
14067
- );
14832
+ function emitError(code, index) {
14833
+ currentOptions.onError(createCompilerError(code, getLoc(index, index)));
14068
14834
  }
14069
- function emitError(context, code, offset, loc = getCursor(context)) {
14070
- if (offset) {
14071
- loc.offset += offset;
14072
- loc.column += offset;
14073
- }
14074
- context.options.onError(
14075
- createCompilerError(code, {
14076
- start: loc,
14077
- end: loc,
14078
- source: ""
14079
- })
14080
- );
14835
+ function reset() {
14836
+ tokenizer.reset();
14837
+ currentOpenTag = null;
14838
+ currentProp = null;
14839
+ currentAttrValue = "";
14840
+ currentAttrStartIndex = -1;
14841
+ currentAttrEndIndex = -1;
14842
+ stack.length = 0;
14081
14843
  }
14082
- function isEnd(context, mode, ancestors) {
14083
- const s = context.source;
14084
- switch (mode) {
14085
- case 0:
14086
- if (startsWith(s, "</")) {
14087
- for (let i = ancestors.length - 1; i >= 0; --i) {
14088
- if (startsWithEndTagOpen(s, ancestors[i].tag)) {
14089
- return true;
14090
- }
14091
- }
14092
- }
14093
- break;
14094
- case 1:
14095
- case 2: {
14096
- const parent = last(ancestors);
14097
- if (parent && startsWithEndTagOpen(s, parent.tag)) {
14098
- return true;
14844
+ function baseParse(input, options) {
14845
+ reset();
14846
+ currentInput = input;
14847
+ currentOptions = extend({}, defaultParserOptions);
14848
+ if (options) {
14849
+ let key;
14850
+ for (key in options) {
14851
+ if (options[key] != null) {
14852
+ currentOptions[key] = options[key];
14099
14853
  }
14100
- break;
14101
14854
  }
14102
- case 3:
14103
- if (startsWith(s, "]]>")) {
14104
- return true;
14105
- }
14106
- break;
14107
14855
  }
14108
- return !s;
14109
- }
14110
- function startsWithEndTagOpen(source, tag) {
14111
- return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
14856
+ {
14857
+ if (!currentOptions.decodeEntities) {
14858
+ throw new Error(
14859
+ `[@vue/compiler-core] decodeEntities option is required in browser builds.`
14860
+ );
14861
+ }
14862
+ }
14863
+ tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
14864
+ const delimiters = options == null ? void 0 : options.delimiters;
14865
+ if (delimiters) {
14866
+ tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
14867
+ tokenizer.delimiterClose = toCharCodes(delimiters[1]);
14868
+ }
14869
+ const root = currentRoot = createRoot([], input);
14870
+ tokenizer.parse(currentInput);
14871
+ root.loc = getLoc(0, input.length);
14872
+ root.children = condenseWhitespace(root.children);
14873
+ currentRoot = null;
14874
+ return root;
14112
14875
  }
14113
14876
 
14114
14877
  function hoistStatic(root, context) {
@@ -14520,6 +15283,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14520
15283
  root.hoists = context.hoists;
14521
15284
  root.temps = context.temps;
14522
15285
  root.cached = context.cached;
15286
+ root.transformed = true;
14523
15287
  {
14524
15288
  root.filters = [...context.filters];
14525
15289
  }
@@ -14676,7 +15440,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14676
15440
  ssr,
14677
15441
  isTS,
14678
15442
  inSSR,
14679
- source: ast.loc.source,
15443
+ source: ast.source,
14680
15444
  code: ``,
14681
15445
  column: 1,
14682
15446
  line: 1,
@@ -14687,7 +15451,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14687
15451
  helper(key) {
14688
15452
  return `_${helperNameMap[key]}`;
14689
15453
  },
14690
- push(code, node) {
15454
+ push(code, newlineIndex = -2 /* None */, node) {
14691
15455
  context.code += code;
14692
15456
  },
14693
15457
  indent() {
@@ -14705,7 +15469,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14705
15469
  }
14706
15470
  };
14707
15471
  function newline(n) {
14708
- context.push("\n" + ` `.repeat(n));
15472
+ context.push("\n" + ` `.repeat(n), 0 /* Start */);
14709
15473
  }
14710
15474
  return context;
14711
15475
  }
@@ -14742,9 +15506,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14742
15506
  push(`with (_ctx) {`);
14743
15507
  indent();
14744
15508
  if (hasHelpers) {
14745
- push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
14746
- push(`
14747
- `);
15509
+ push(
15510
+ `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15511
+ `,
15512
+ -1 /* End */
15513
+ );
14748
15514
  newline();
14749
15515
  }
14750
15516
  }
@@ -14773,7 +15539,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14773
15539
  }
14774
15540
  if (ast.components.length || ast.directives.length || ast.temps) {
14775
15541
  push(`
14776
- `);
15542
+ `, 0 /* Start */);
14777
15543
  newline();
14778
15544
  }
14779
15545
  if (!ssr) {
@@ -14794,7 +15560,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14794
15560
  ast,
14795
15561
  code: context.code,
14796
15562
  preamble: isSetupInlined ? preambleContext.code : ``,
14797
- // SourceMapGenerator does have toJSON() method but it's not in the types
14798
15563
  map: context.map ? context.map.toJSON() : void 0
14799
15564
  };
14800
15565
  }
@@ -14813,7 +15578,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14813
15578
  if (helpers.length > 0) {
14814
15579
  {
14815
15580
  push(`const _Vue = ${VueBinding}
14816
- `);
15581
+ `, -1 /* End */);
14817
15582
  if (ast.hoists.length) {
14818
15583
  const staticHelpers = [
14819
15584
  CREATE_VNODE,
@@ -14823,7 +15588,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14823
15588
  CREATE_STATIC
14824
15589
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
14825
15590
  push(`const { ${staticHelpers} } = _Vue
14826
- `);
15591
+ `, -1 /* End */);
14827
15592
  }
14828
15593
  }
14829
15594
  }
@@ -14884,7 +15649,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14884
15649
  for (let i = 0; i < nodes.length; i++) {
14885
15650
  const node = nodes[i];
14886
15651
  if (isString(node)) {
14887
- push(node);
15652
+ push(node, -3 /* Unknown */);
14888
15653
  } else if (isArray(node)) {
14889
15654
  genNodeListAsArray(node, context);
14890
15655
  } else {
@@ -14902,7 +15667,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14902
15667
  }
14903
15668
  function genNode(node, context) {
14904
15669
  if (isString(node)) {
14905
- context.push(node);
15670
+ context.push(node, -3 /* Unknown */);
14906
15671
  return;
14907
15672
  }
14908
15673
  if (isSymbol(node)) {
@@ -14982,11 +15747,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14982
15747
  }
14983
15748
  }
14984
15749
  function genText(node, context) {
14985
- context.push(JSON.stringify(node.content), node);
15750
+ context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
14986
15751
  }
14987
15752
  function genExpression(node, context) {
14988
15753
  const { content, isStatic } = node;
14989
- context.push(isStatic ? JSON.stringify(content) : content, node);
15754
+ context.push(
15755
+ isStatic ? JSON.stringify(content) : content,
15756
+ -3 /* Unknown */,
15757
+ node
15758
+ );
14990
15759
  }
14991
15760
  function genInterpolation(node, context) {
14992
15761
  const { push, helper, pure } = context;
@@ -15000,7 +15769,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15000
15769
  for (let i = 0; i < node.children.length; i++) {
15001
15770
  const child = node.children[i];
15002
15771
  if (isString(child)) {
15003
- context.push(child);
15772
+ context.push(child, -3 /* Unknown */);
15004
15773
  } else {
15005
15774
  genNode(child, context);
15006
15775
  }
@@ -15014,9 +15783,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15014
15783
  push(`]`);
15015
15784
  } else if (node.isStatic) {
15016
15785
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15017
- push(text, node);
15786
+ push(text, -2 /* None */, node);
15018
15787
  } else {
15019
- push(`[${node.content}]`, node);
15788
+ push(`[${node.content}]`, -3 /* Unknown */, node);
15020
15789
  }
15021
15790
  }
15022
15791
  function genComment(node, context) {
@@ -15024,7 +15793,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15024
15793
  if (pure) {
15025
15794
  push(PURE_ANNOTATION);
15026
15795
  }
15027
- push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
15796
+ push(
15797
+ `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15798
+ -3 /* Unknown */,
15799
+ node
15800
+ );
15028
15801
  }
15029
15802
  function genVNodeCall(node, context) {
15030
15803
  const { push, helper, pure } = context;
@@ -15049,7 +15822,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15049
15822
  push(PURE_ANNOTATION);
15050
15823
  }
15051
15824
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15052
- push(helper(callHelper) + `(`, node);
15825
+ push(helper(callHelper) + `(`, -2 /* None */, node);
15053
15826
  genNodeList(
15054
15827
  genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
15055
15828
  context
@@ -15078,7 +15851,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15078
15851
  if (pure) {
15079
15852
  push(PURE_ANNOTATION);
15080
15853
  }
15081
- push(callee + `(`, node);
15854
+ push(callee + `(`, -2 /* None */, node);
15082
15855
  genNodeList(node.arguments, context);
15083
15856
  push(`)`);
15084
15857
  }
@@ -15086,7 +15859,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15086
15859
  const { push, indent, deindent, newline } = context;
15087
15860
  const { properties } = node;
15088
15861
  if (!properties.length) {
15089
- push(`{}`, node);
15862
+ push(`{}`, -2 /* None */, node);
15090
15863
  return;
15091
15864
  }
15092
15865
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -15114,7 +15887,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15114
15887
  if (isSlot) {
15115
15888
  push(`_${helperNameMap[WITH_CTX]}(`);
15116
15889
  }
15117
- push(`(`, node);
15890
+ push(`(`, -2 /* None */, node);
15118
15891
  if (isArray(params)) {
15119
15892
  genNodeList(params, context);
15120
15893
  } else if (params) {
@@ -15348,7 +16121,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15348
16121
  context.removeNode();
15349
16122
  const branch = createIfBranch(node, dir);
15350
16123
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15351
- !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
16124
+ !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15352
16125
  branch.children = [...comments, ...branch.children];
15353
16126
  }
15354
16127
  {
@@ -15630,18 +16403,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15630
16403
  );
15631
16404
  return;
15632
16405
  }
15633
- const parseResult = parseForExpression(
15634
- // can only be simple expression because vFor transform is applied
15635
- // before expression transform.
15636
- dir.exp,
15637
- context
15638
- );
16406
+ const parseResult = dir.forParseResult;
15639
16407
  if (!parseResult) {
15640
16408
  context.onError(
15641
16409
  createCompilerError(32, dir.loc)
15642
16410
  );
15643
16411
  return;
15644
16412
  }
16413
+ finalizeForParseResult(parseResult, context);
15645
16414
  const { addIdentifiers, removeIdentifiers, scopes } = context;
15646
16415
  const { source, value, key, index } = parseResult;
15647
16416
  const forNode = {
@@ -15663,71 +16432,26 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15663
16432
  onExit();
15664
16433
  };
15665
16434
  }
15666
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15667
- const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15668
- const stripParensRE = /^\(|\)$/g;
15669
- function parseForExpression(input, context) {
15670
- const loc = input.loc;
15671
- const exp = input.content;
15672
- const inMatch = exp.match(forAliasRE);
15673
- if (!inMatch)
16435
+ function finalizeForParseResult(result, context) {
16436
+ if (result.finalized)
15674
16437
  return;
15675
- const [, LHS, RHS] = inMatch;
15676
- const result = {
15677
- source: createAliasExpression(
15678
- loc,
15679
- RHS.trim(),
15680
- exp.indexOf(RHS, LHS.length)
15681
- ),
15682
- value: void 0,
15683
- key: void 0,
15684
- index: void 0
15685
- };
15686
16438
  {
15687
16439
  validateBrowserExpression(result.source, context);
15688
- }
15689
- let valueContent = LHS.trim().replace(stripParensRE, "").trim();
15690
- const trimmedOffset = LHS.indexOf(valueContent);
15691
- const iteratorMatch = valueContent.match(forIteratorRE);
15692
- if (iteratorMatch) {
15693
- valueContent = valueContent.replace(forIteratorRE, "").trim();
15694
- const keyContent = iteratorMatch[1].trim();
15695
- let keyOffset;
15696
- if (keyContent) {
15697
- keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
15698
- result.key = createAliasExpression(loc, keyContent, keyOffset);
15699
- {
15700
- validateBrowserExpression(
15701
- result.key,
15702
- context,
15703
- true
15704
- );
15705
- }
16440
+ if (result.key) {
16441
+ validateBrowserExpression(
16442
+ result.key,
16443
+ context,
16444
+ true
16445
+ );
15706
16446
  }
15707
- if (iteratorMatch[2]) {
15708
- const indexContent = iteratorMatch[2].trim();
15709
- if (indexContent) {
15710
- result.index = createAliasExpression(
15711
- loc,
15712
- indexContent,
15713
- exp.indexOf(
15714
- indexContent,
15715
- result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
15716
- )
15717
- );
15718
- {
15719
- validateBrowserExpression(
15720
- result.index,
15721
- context,
15722
- true
15723
- );
15724
- }
15725
- }
16447
+ if (result.index) {
16448
+ validateBrowserExpression(
16449
+ result.index,
16450
+ context,
16451
+ true
16452
+ );
15726
16453
  }
15727
- }
15728
- if (valueContent) {
15729
- result.value = createAliasExpression(loc, valueContent, trimmedOffset);
15730
- {
16454
+ if (result.value) {
15731
16455
  validateBrowserExpression(
15732
16456
  result.value,
15733
16457
  context,
@@ -15735,14 +16459,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15735
16459
  );
15736
16460
  }
15737
16461
  }
15738
- return result;
15739
- }
15740
- function createAliasExpression(range, content, offset) {
15741
- return createSimpleExpression(
15742
- content,
15743
- false,
15744
- getInnerRange(range, offset, content.length)
15745
- );
16462
+ result.finalized = true;
15746
16463
  }
15747
16464
  function createForLoopParams({ value, key, index }, memoArgs = []) {
15748
16465
  return createParamsList([value, key, index, ...memoArgs]);
@@ -15829,12 +16546,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15829
16546
  hasDynamicSlots = true;
15830
16547
  }
15831
16548
  const vFor = findDir(slotElement, "for");
15832
- const slotFunction = buildSlotFn(
15833
- slotProps,
15834
- vFor == null ? void 0 : vFor.exp,
15835
- slotChildren,
15836
- slotLoc
15837
- );
16549
+ const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
15838
16550
  let vIf;
15839
16551
  let vElse;
15840
16552
  if (vIf = findDir(slotElement, "if")) {
@@ -15883,8 +16595,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15883
16595
  }
15884
16596
  } else if (vFor) {
15885
16597
  hasDynamicSlots = true;
15886
- const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
16598
+ const parseResult = vFor.forParseResult;
15887
16599
  if (parseResult) {
16600
+ finalizeForParseResult(parseResult, context);
15888
16601
  dynamicSlots.push(
15889
16602
  createCallExpression(context.helper(RENDER_LIST), [
15890
16603
  parseResult.source,
@@ -16145,17 +16858,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16145
16858
  tag = isProp.value.content.slice(4);
16146
16859
  }
16147
16860
  }
16148
- const isDir = !isExplicitDynamic && findDir(node, "is");
16149
- if (isDir && isDir.exp) {
16150
- {
16151
- context.onWarn(
16152
- createCompilerError(52, isDir.loc)
16153
- );
16154
- }
16155
- return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16156
- isDir.exp
16157
- ]);
16158
- }
16159
16861
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16160
16862
  if (builtIn) {
16161
16863
  if (!ssr)
@@ -16227,7 +16929,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16227
16929
  for (let i = 0; i < props.length; i++) {
16228
16930
  const prop = props[i];
16229
16931
  if (prop.type === 6) {
16230
- const { loc, name, value } = prop;
16932
+ const { loc, name, nameLoc, value } = prop;
16231
16933
  let isStatic = true;
16232
16934
  if (name === "ref") {
16233
16935
  hasRef = true;
@@ -16248,11 +16950,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16248
16950
  }
16249
16951
  properties.push(
16250
16952
  createObjectProperty(
16251
- createSimpleExpression(
16252
- name,
16253
- true,
16254
- getInnerRange(loc, 0, name.length)
16255
- ),
16953
+ createSimpleExpression(name, true, nameLoc),
16256
16954
  createSimpleExpression(
16257
16955
  value ? value.content : "",
16258
16956
  isStatic,
@@ -16261,7 +16959,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16261
16959
  )
16262
16960
  );
16263
16961
  } else {
16264
- const { name, arg, exp, loc } = prop;
16962
+ const { name, arg, exp, loc, modifiers } = prop;
16265
16963
  const isVBind = name === "bind";
16266
16964
  const isVOn = name === "on";
16267
16965
  if (name === "slot") {
@@ -16354,6 +17052,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16354
17052
  }
16355
17053
  continue;
16356
17054
  }
17055
+ if (isVBind && modifiers.includes("prop")) {
17056
+ patchFlag |= 32;
17057
+ }
16357
17058
  const directiveTransform = context.directiveTransforms[name];
16358
17059
  if (directiveTransform) {
16359
17060
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -16731,8 +17432,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16731
17432
  };
16732
17433
 
16733
17434
  const transformBind = (dir, _node, context) => {
16734
- const { exp, modifiers, loc } = dir;
17435
+ const { modifiers, loc } = dir;
16735
17436
  const arg = dir.arg;
17437
+ let { exp } = dir;
17438
+ if (!exp && arg.type === 4) {
17439
+ const propName = camelize(arg.content);
17440
+ exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
17441
+ }
16736
17442
  if (arg.type !== 4) {
16737
17443
  arg.children.unshift(`(`);
16738
17444
  arg.children.push(`) || ""`);
@@ -17131,7 +17837,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17131
17837
  }
17132
17838
  ];
17133
17839
  }
17134
- function baseCompile(template, options = {}) {
17840
+ function baseCompile(source, options = {}) {
17135
17841
  const onError = options.onError || defaultOnError;
17136
17842
  const isModuleMode = options.mode === "module";
17137
17843
  {
@@ -17148,7 +17854,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17148
17854
  if (options.scopeId && !isModuleMode) {
17149
17855
  onError(createCompilerError(50));
17150
17856
  }
17151
- const ast = isString(template) ? baseParse(template, options) : template;
17857
+ const ast = isString(source) ? baseParse(source, options) : source;
17152
17858
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17153
17859
  transform(
17154
17860
  ast,
@@ -17214,25 +17920,22 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17214
17920
  }
17215
17921
  }
17216
17922
 
17217
- const isRawTextContainer = /* @__PURE__ */ makeMap(
17218
- "style,iframe,script,noscript",
17219
- true
17220
- );
17221
17923
  const parserOptions = {
17924
+ parseMode: "html",
17222
17925
  isVoidTag,
17223
17926
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
17224
17927
  isPreTag: (tag) => tag === "pre",
17225
17928
  decodeEntities: decodeHtmlBrowser ,
17226
17929
  isBuiltInComponent: (tag) => {
17227
- if (isBuiltInType(tag, `Transition`)) {
17930
+ if (tag === "Transition" || tag === "transition") {
17228
17931
  return TRANSITION;
17229
- } else if (isBuiltInType(tag, `TransitionGroup`)) {
17932
+ } else if (tag === "TransitionGroup" || tag === "transition-group") {
17230
17933
  return TRANSITION_GROUP;
17231
17934
  }
17232
17935
  },
17233
17936
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17234
- getNamespace(tag, parent) {
17235
- let ns = parent ? parent.ns : 0;
17937
+ getNamespace(tag, parent, rootNamespace) {
17938
+ let ns = parent ? parent.ns : rootNamespace;
17236
17939
  if (parent && ns === 2) {
17237
17940
  if (parent.tag === "annotation-xml") {
17238
17941
  if (tag === "svg") {
@@ -17260,18 +17963,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17260
17963
  }
17261
17964
  }
17262
17965
  return ns;
17263
- },
17264
- // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
17265
- getTextMode({ tag, ns }) {
17266
- if (ns === 0) {
17267
- if (tag === "textarea" || tag === "title") {
17268
- return 1;
17269
- }
17270
- if (isRawTextContainer(tag)) {
17271
- return 2;
17272
- }
17273
- }
17274
- return 0;
17275
17966
  }
17276
17967
  };
17277
17968
 
@@ -17386,8 +18077,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17386
18077
  );
17387
18078
  }
17388
18079
  function checkDuplicatedValue() {
17389
- const value = findProp(node, "value");
17390
- if (value) {
18080
+ const value = findDir(node, "bind");
18081
+ if (value && isStaticArgOf(value.arg, "value")) {
17391
18082
  context.onError(
17392
18083
  createDOMCompilerError(
17393
18084
  60,
@@ -17592,6 +18283,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17592
18283
  node.props.push({
17593
18284
  type: 6,
17594
18285
  name: "persisted",
18286
+ nameLoc: node.loc,
17595
18287
  value: void 0,
17596
18288
  loc: node.loc
17597
18289
  });
@@ -17636,9 +18328,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17636
18328
  // override compiler-core
17637
18329
  show: transformShow
17638
18330
  };
17639
- function compile(template, options = {}) {
18331
+ function compile(src, options = {}) {
17640
18332
  return baseCompile(
17641
- template,
18333
+ src,
17642
18334
  extend({}, parserOptions, options, {
17643
18335
  nodeTransforms: [
17644
18336
  // ignore <script> and <tag>