@vue/compat 3.6.0-alpha.2 → 3.6.0-alpha.3

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.2
2
+ * @vue/compat v3.6.0-alpha.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,7 +10,6 @@ var estreeWalker = require('estree-walker');
10
10
  var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
- /*! #__NO_SIDE_EFFECTS__ */
14
13
  // @__NO_SIDE_EFFECTS__
15
14
  function makeMap(str) {
16
15
  const map = /* @__PURE__ */ Object.create(null);
@@ -66,10 +65,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
66
65
  );
67
66
  const cacheStringFunction = (fn) => {
68
67
  const cache = /* @__PURE__ */ Object.create(null);
69
- return (str) => {
68
+ return ((str) => {
70
69
  const hit = cache[str];
71
70
  return hit || (cache[str] = fn(str));
72
- };
71
+ });
73
72
  };
74
73
  const camelizeRE = /-(\w)/g;
75
74
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -322,6 +321,9 @@ function shouldSetAsAttr(tagName, key) {
322
321
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
323
322
  return true;
324
323
  }
324
+ if (key === "sandbox" && tagName === "IFRAME") {
325
+ return true;
326
+ }
325
327
  return false;
326
328
  }
327
329
 
@@ -550,6 +552,7 @@ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
550
552
  const notifyBuffer = [];
551
553
  let batchDepth = 0;
552
554
  let activeSub = void 0;
555
+ let globalVersion = 0;
553
556
  let notifyIndex = 0;
554
557
  let notifyBufferLength = 0;
555
558
  function setActiveSub(sub) {
@@ -572,17 +575,18 @@ function link(dep, sub) {
572
575
  if (prevDep !== void 0 && prevDep.dep === dep) {
573
576
  return;
574
577
  }
575
- let nextDep = void 0;
576
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
577
- if (recursedCheck) {
578
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
579
- if (nextDep !== void 0 && nextDep.dep === dep) {
580
- sub.depsTail = nextDep;
581
- return;
582
- }
578
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
579
+ if (nextDep !== void 0 && nextDep.dep === dep) {
580
+ nextDep.version = globalVersion;
581
+ sub.depsTail = nextDep;
582
+ return;
583
583
  }
584
584
  const prevSub = dep.subsTail;
585
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
586
+ return;
587
+ }
585
588
  const newLink = sub.depsTail = dep.subsTail = {
589
+ version: globalVersion,
586
590
  dep,
587
591
  sub,
588
592
  prevDep,
@@ -688,6 +692,7 @@ function propagate(link2) {
688
692
  } while (true);
689
693
  }
690
694
  function startTracking(sub) {
695
+ ++globalVersion;
691
696
  sub.depsTail = void 0;
692
697
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
693
698
  return setActiveSub(sub);
@@ -788,18 +793,12 @@ function shallowPropagate(link2) {
788
793
  } while (link2 !== void 0);
789
794
  }
790
795
  function isValidLink(checkLink, sub) {
791
- const depsTail = sub.depsTail;
792
- if (depsTail !== void 0) {
793
- let link2 = sub.deps;
794
- do {
795
- if (link2 === checkLink) {
796
- return true;
797
- }
798
- if (link2 === depsTail) {
799
- break;
800
- }
801
- link2 = link2.nextDep;
802
- } while (link2 !== void 0);
796
+ let link2 = sub.depsTail;
797
+ while (link2 !== void 0) {
798
+ if (link2 === checkLink) {
799
+ return true;
800
+ }
801
+ link2 = link2.prevDep;
803
802
  }
804
803
  return false;
805
804
  }
@@ -1039,7 +1038,7 @@ const arrayInstrumentations = {
1039
1038
  join(separator) {
1040
1039
  return reactiveReadArray(this).join(separator);
1041
1040
  },
1042
- // keys() iterator only reads `length`, no optimisation required
1041
+ // keys() iterator only reads `length`, no optimization required
1043
1042
  lastIndexOf(...args) {
1044
1043
  return searchProxy(this, "lastIndexOf", args);
1045
1044
  },
@@ -1091,7 +1090,7 @@ function iterator(self, method, wrapValue) {
1091
1090
  iter._next = iter.next;
1092
1091
  iter.next = () => {
1093
1092
  const result = iter._next();
1094
- if (result.value) {
1093
+ if (!result.done) {
1095
1094
  result.value = wrapValue(result.value);
1096
1095
  }
1097
1096
  return result;
@@ -1222,7 +1221,8 @@ class BaseReactiveHandler {
1222
1221
  return res;
1223
1222
  }
1224
1223
  if (isRef(res)) {
1225
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1224
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1225
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1226
1226
  }
1227
1227
  if (isObject(res)) {
1228
1228
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1244,7 +1244,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1244
1244
  }
1245
1245
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1246
1246
  if (isOldValueReadonly) {
1247
- return false;
1247
+ {
1248
+ warn$2(
1249
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1250
+ target[key]
1251
+ );
1252
+ }
1253
+ return true;
1248
1254
  } else {
1249
1255
  oldValue.value = value;
1250
1256
  return true;
@@ -1389,7 +1395,7 @@ function createInstrumentations(readonly, shallow) {
1389
1395
  get size() {
1390
1396
  const target = this["__v_raw"];
1391
1397
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1392
- return Reflect.get(target, "size", target);
1398
+ return target.size;
1393
1399
  },
1394
1400
  has(key) {
1395
1401
  const target = this["__v_raw"];
@@ -2392,11 +2398,11 @@ function traverse(value, depth = Infinity, seen) {
2392
2398
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2393
2399
  return value;
2394
2400
  }
2395
- seen = seen || /* @__PURE__ */ new Set();
2396
- if (seen.has(value)) {
2401
+ seen = seen || /* @__PURE__ */ new Map();
2402
+ if ((seen.get(value) || 0) >= depth) {
2397
2403
  return value;
2398
2404
  }
2399
- seen.add(value);
2405
+ seen.set(value, depth);
2400
2406
  depth--;
2401
2407
  if (isRef(value)) {
2402
2408
  traverse(value.value, depth, seen);
@@ -2942,8 +2948,10 @@ function rerender(id, newRender) {
2942
2948
  instance.hmrRerender();
2943
2949
  } else {
2944
2950
  const i = instance;
2945
- i.renderCache = [];
2946
- i.effect.run();
2951
+ if (!(i.effect.flags & 1024)) {
2952
+ i.renderCache = [];
2953
+ i.effect.run();
2954
+ }
2947
2955
  }
2948
2956
  nextTick(() => {
2949
2957
  isHmrUpdating = false;
@@ -2985,7 +2993,10 @@ function reload(id, newComp) {
2985
2993
  if (parent.vapor) {
2986
2994
  parent.hmrRerender();
2987
2995
  } else {
2988
- parent.effect.run();
2996
+ if (!(parent.effect.flags & 1024)) {
2997
+ parent.renderCache = [];
2998
+ parent.effect.run();
2999
+ }
2989
3000
  }
2990
3001
  nextTick(() => {
2991
3002
  isHmrUpdating = false;
@@ -3095,7 +3106,6 @@ const devtoolsComponentRemoved = (component) => {
3095
3106
  _devtoolsComponentRemoved(component);
3096
3107
  }
3097
3108
  };
3098
- /*! #__NO_SIDE_EFFECTS__ */
3099
3109
  // @__NO_SIDE_EFFECTS__
3100
3110
  function createDevtoolsComponentHook(hook) {
3101
3111
  return (component) => {
@@ -3809,9 +3819,6 @@ const TeleportImpl = {
3809
3819
  insert(mainAnchor, container, anchor);
3810
3820
  const mount = (container2, anchor2) => {
3811
3821
  if (shapeFlag & 16) {
3812
- if (parentComponent && parentComponent.isCE) {
3813
- parentComponent.ce._teleportTarget = container2;
3814
- }
3815
3822
  mountChildren(
3816
3823
  children,
3817
3824
  container2,
@@ -3833,6 +3840,9 @@ const TeleportImpl = {
3833
3840
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3834
3841
  namespace = "mathml";
3835
3842
  }
3843
+ if (parentComponent && parentComponent.isCE) {
3844
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3845
+ }
3836
3846
  if (!disabled) {
3837
3847
  mount(target, targetAnchor);
3838
3848
  updateCssVars(n2, false);
@@ -4033,26 +4043,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
4033
4043
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
4034
4044
  o: { nextSibling, parentNode, querySelector, insert, createText }
4035
4045
  }, hydrateChildren) {
4046
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
4047
+ vnode2.anchor = hydrateChildren(
4048
+ nextSibling(node2),
4049
+ vnode2,
4050
+ parentNode(node2),
4051
+ parentComponent,
4052
+ parentSuspense,
4053
+ slotScopeIds,
4054
+ optimized
4055
+ );
4056
+ vnode2.targetStart = targetStart;
4057
+ vnode2.targetAnchor = targetAnchor;
4058
+ }
4036
4059
  const target = vnode.target = resolveTarget(
4037
4060
  vnode.props,
4038
4061
  querySelector
4039
4062
  );
4063
+ const disabled = isTeleportDisabled(vnode.props);
4040
4064
  if (target) {
4041
- const disabled = isTeleportDisabled(vnode.props);
4042
4065
  const targetNode = target._lpa || target.firstChild;
4043
4066
  if (vnode.shapeFlag & 16) {
4044
4067
  if (disabled) {
4045
- vnode.anchor = hydrateChildren(
4046
- nextSibling(node),
4068
+ hydrateDisabledTeleport(
4069
+ node,
4047
4070
  vnode,
4048
- parentNode(node),
4049
- parentComponent,
4050
- parentSuspense,
4051
- slotScopeIds,
4052
- optimized
4071
+ targetNode,
4072
+ targetNode && nextSibling(targetNode)
4053
4073
  );
4054
- vnode.targetStart = targetNode;
4055
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
4056
4074
  } else {
4057
4075
  vnode.anchor = nextSibling(node);
4058
4076
  let targetAnchor = targetNode;
@@ -4083,6 +4101,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
4083
4101
  }
4084
4102
  }
4085
4103
  updateCssVars(vnode, disabled);
4104
+ } else if (disabled) {
4105
+ if (vnode.shapeFlag & 16) {
4106
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
4107
+ }
4086
4108
  }
4087
4109
  return vnode.anchor && nextSibling(vnode.anchor);
4088
4110
  }
@@ -4123,7 +4145,7 @@ function useTransitionState() {
4123
4145
  isMounted: false,
4124
4146
  isLeaving: false,
4125
4147
  isUnmounting: false,
4126
- leavingVNodes: /* @__PURE__ */ new Map()
4148
+ leavingNodes: /* @__PURE__ */ new Map()
4127
4149
  };
4128
4150
  onMounted(() => {
4129
4151
  state.isMounted = true;
@@ -4155,7 +4177,7 @@ const BaseTransitionPropsValidators = {
4155
4177
  onAppearCancelled: TransitionHookValidator
4156
4178
  };
4157
4179
  const recursiveGetSubtree = (instance) => {
4158
- const subTree = instance.subTree;
4180
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
4159
4181
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
4160
4182
  };
4161
4183
  const BaseTransitionImpl = {
@@ -4172,9 +4194,7 @@ const BaseTransitionImpl = {
4172
4194
  const child = findNonCommentChild(children);
4173
4195
  const rawProps = toRaw(props);
4174
4196
  const { mode } = rawProps;
4175
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4176
- warn$1(`invalid <transition> mode: ${mode}`);
4177
- }
4197
+ checkTransitionMode(mode);
4178
4198
  if (state.isLeaving) {
4179
4199
  return emptyPlaceholder(child);
4180
4200
  }
@@ -4194,7 +4214,7 @@ const BaseTransitionImpl = {
4194
4214
  setTransitionHooks(innerChild, enterHooks);
4195
4215
  }
4196
4216
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
4197
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
4217
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
4198
4218
  let leavingHooks = resolveTransitionHooks(
4199
4219
  oldInnerChild,
4200
4220
  rawProps,
@@ -4266,15 +4286,53 @@ function findNonCommentChild(children) {
4266
4286
  }
4267
4287
  const BaseTransition = BaseTransitionImpl;
4268
4288
  function getLeavingNodesForType(state, vnode) {
4269
- const { leavingVNodes } = state;
4270
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
4289
+ const { leavingNodes } = state;
4290
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
4271
4291
  if (!leavingVNodesCache) {
4272
4292
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
4273
- leavingVNodes.set(vnode.type, leavingVNodesCache);
4293
+ leavingNodes.set(vnode.type, leavingVNodesCache);
4274
4294
  }
4275
4295
  return leavingVNodesCache;
4276
4296
  }
4277
4297
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4298
+ const key = String(vnode.key);
4299
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4300
+ const context = {
4301
+ setLeavingNodeCache: () => {
4302
+ leavingVNodesCache[key] = vnode;
4303
+ },
4304
+ unsetLeavingNodeCache: () => {
4305
+ if (leavingVNodesCache[key] === vnode) {
4306
+ delete leavingVNodesCache[key];
4307
+ }
4308
+ },
4309
+ earlyRemove: () => {
4310
+ const leavingVNode = leavingVNodesCache[key];
4311
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4312
+ leavingVNode.el[leaveCbKey]();
4313
+ }
4314
+ },
4315
+ cloneHooks: (vnode2) => {
4316
+ const hooks = resolveTransitionHooks(
4317
+ vnode2,
4318
+ props,
4319
+ state,
4320
+ instance,
4321
+ postClone
4322
+ );
4323
+ if (postClone) postClone(hooks);
4324
+ return hooks;
4325
+ }
4326
+ };
4327
+ return baseResolveTransitionHooks(context, props, state, instance);
4328
+ }
4329
+ function baseResolveTransitionHooks(context, props, state, instance) {
4330
+ const {
4331
+ setLeavingNodeCache,
4332
+ unsetLeavingNodeCache,
4333
+ earlyRemove,
4334
+ cloneHooks
4335
+ } = context;
4278
4336
  const {
4279
4337
  appear,
4280
4338
  mode,
@@ -4292,8 +4350,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4292
4350
  onAfterAppear,
4293
4351
  onAppearCancelled
4294
4352
  } = props;
4295
- const key = String(vnode.key);
4296
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4297
4353
  const callHook = (hook, args) => {
4298
4354
  hook && callWithAsyncErrorHandling(
4299
4355
  hook,
@@ -4329,10 +4385,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4329
4385
  /* cancelled */
4330
4386
  );
4331
4387
  }
4332
- const leavingVNode = leavingVNodesCache[key];
4333
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4334
- leavingVNode.el[leaveCbKey]();
4335
- }
4388
+ earlyRemove();
4336
4389
  callHook(hook, [el]);
4337
4390
  },
4338
4391
  enter(el) {
@@ -4369,7 +4422,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4369
4422
  }
4370
4423
  },
4371
4424
  leave(el, remove) {
4372
- const key2 = String(vnode.key);
4373
4425
  if (el[enterCbKey$1]) {
4374
4426
  el[enterCbKey$1](
4375
4427
  true
@@ -4391,27 +4443,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4391
4443
  callHook(onAfterLeave, [el]);
4392
4444
  }
4393
4445
  el[leaveCbKey] = void 0;
4394
- if (leavingVNodesCache[key2] === vnode) {
4395
- delete leavingVNodesCache[key2];
4396
- }
4446
+ unsetLeavingNodeCache(el);
4397
4447
  };
4398
- leavingVNodesCache[key2] = vnode;
4448
+ setLeavingNodeCache(el);
4399
4449
  if (onLeave) {
4400
4450
  callAsyncHook(onLeave, [el, done]);
4401
4451
  } else {
4402
4452
  done();
4403
4453
  }
4404
4454
  },
4405
- clone(vnode2) {
4406
- const hooks2 = resolveTransitionHooks(
4407
- vnode2,
4408
- props,
4409
- state,
4410
- instance,
4411
- postClone
4412
- );
4413
- if (postClone) postClone(hooks2);
4414
- return hooks2;
4455
+ clone(node) {
4456
+ return cloneHooks(node);
4415
4457
  }
4416
4458
  };
4417
4459
  return hooks;
@@ -4445,8 +4487,15 @@ function getInnerChild$1(vnode) {
4445
4487
  }
4446
4488
  function setTransitionHooks(vnode, hooks) {
4447
4489
  if (vnode.shapeFlag & 6 && vnode.component) {
4448
- vnode.transition = hooks;
4449
- setTransitionHooks(vnode.component.subTree, hooks);
4490
+ if (vnode.type.__vapor) {
4491
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
4492
+ vnode.component,
4493
+ hooks
4494
+ );
4495
+ } else {
4496
+ vnode.transition = hooks;
4497
+ setTransitionHooks(vnode.component.subTree, hooks);
4498
+ }
4450
4499
  } else if (vnode.shapeFlag & 128) {
4451
4500
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4452
4501
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4476,8 +4525,12 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4476
4525
  }
4477
4526
  return ret;
4478
4527
  }
4528
+ function checkTransitionMode(mode) {
4529
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4530
+ warn$1(`invalid <transition> mode: ${mode}`);
4531
+ }
4532
+ }
4479
4533
 
4480
- /*! #__NO_SIDE_EFFECTS__ */
4481
4534
  // @__NO_SIDE_EFFECTS__
4482
4535
  function defineComponent(options, extraOptions) {
4483
4536
  return isFunction(options) ? (
@@ -4530,6 +4583,7 @@ function useTemplateRef(key) {
4530
4583
  return ret;
4531
4584
  }
4532
4585
 
4586
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4533
4587
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4534
4588
  if (isArray(rawRef)) {
4535
4589
  rawRef.forEach(
@@ -4561,28 +4615,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4561
4615
  const oldRef = oldRawRef && oldRawRef.r;
4562
4616
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4563
4617
  const setupState = owner.setupState;
4564
- const rawSetupState = toRaw(setupState);
4565
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4566
- {
4567
- if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4568
- warn$1(
4569
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4570
- );
4571
- }
4572
- if (knownTemplateRefs.has(rawSetupState[key])) {
4573
- return false;
4574
- }
4575
- }
4576
- return hasOwn(rawSetupState, key);
4618
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
4619
+ const canSetRef = (ref2) => {
4620
+ return !knownTemplateRefs.has(ref2);
4577
4621
  };
4578
4622
  if (oldRef != null && oldRef !== ref) {
4623
+ invalidatePendingSetRef(oldRawRef);
4579
4624
  if (isString(oldRef)) {
4580
4625
  refs[oldRef] = null;
4581
4626
  if (canSetSetupRef(oldRef)) {
4582
4627
  setupState[oldRef] = null;
4583
4628
  }
4584
4629
  } else if (isRef(oldRef)) {
4585
- oldRef.value = null;
4630
+ if (canSetRef(oldRef)) {
4631
+ oldRef.value = null;
4632
+ }
4633
+ const oldRawRefAtom = oldRawRef;
4634
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4586
4635
  }
4587
4636
  }
4588
4637
  if (isFunction(ref)) {
@@ -4593,7 +4642,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4593
4642
  if (_isString || _isRef) {
4594
4643
  const doSet = () => {
4595
4644
  if (rawRef.f) {
4596
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4645
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4597
4646
  if (isUnmount) {
4598
4647
  isArray(existing) && remove(existing, refValue);
4599
4648
  } else {
@@ -4604,8 +4653,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4604
4653
  setupState[ref] = refs[ref];
4605
4654
  }
4606
4655
  } else {
4607
- ref.value = [refValue];
4608
- if (rawRef.k) refs[rawRef.k] = ref.value;
4656
+ const newVal = [refValue];
4657
+ if (canSetRef(ref)) {
4658
+ ref.value = newVal;
4659
+ }
4660
+ if (rawRef.k) refs[rawRef.k] = newVal;
4609
4661
  }
4610
4662
  } else if (!existing.includes(refValue)) {
4611
4663
  existing.push(refValue);
@@ -4617,15 +4669,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4617
4669
  setupState[ref] = value;
4618
4670
  }
4619
4671
  } else if (_isRef) {
4620
- ref.value = value;
4672
+ if (canSetRef(ref)) {
4673
+ ref.value = value;
4674
+ }
4621
4675
  if (rawRef.k) refs[rawRef.k] = value;
4622
4676
  } else {
4623
4677
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4624
4678
  }
4625
4679
  };
4626
4680
  if (value) {
4627
- queuePostRenderEffect(doSet, -1, parentSuspense);
4681
+ const job = () => {
4682
+ doSet();
4683
+ pendingSetRefMap.delete(rawRef);
4684
+ };
4685
+ pendingSetRefMap.set(rawRef, job);
4686
+ queuePostRenderEffect(job, -1, parentSuspense);
4628
4687
  } else {
4688
+ invalidatePendingSetRef(rawRef);
4629
4689
  doSet();
4630
4690
  }
4631
4691
  } else {
@@ -4633,6 +4693,29 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4633
4693
  }
4634
4694
  }
4635
4695
  }
4696
+ function createCanSetSetupRefChecker(setupState) {
4697
+ const rawSetupState = toRaw(setupState);
4698
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
4699
+ {
4700
+ if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4701
+ warn$1(
4702
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4703
+ );
4704
+ }
4705
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4706
+ return false;
4707
+ }
4708
+ }
4709
+ return hasOwn(rawSetupState, key);
4710
+ };
4711
+ }
4712
+ function invalidatePendingSetRef(rawRef) {
4713
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4714
+ if (pendingSetRef) {
4715
+ pendingSetRef.flags |= 4;
4716
+ pendingSetRefMap.delete(rawRef);
4717
+ }
4718
+ }
4636
4719
 
4637
4720
  let hasLoggedMismatchError = false;
4638
4721
  const logMismatchError = () => {
@@ -4729,7 +4812,7 @@ function createHydrationFunctions(rendererInternals) {
4729
4812
  }
4730
4813
  break;
4731
4814
  case Comment:
4732
- if (isTemplateNode(node)) {
4815
+ if (isTemplateNode$1(node)) {
4733
4816
  nextNode = nextSibling(node);
4734
4817
  replaceNode(
4735
4818
  vnode.el = node.content.firstChild,
@@ -4777,9 +4860,15 @@ function createHydrationFunctions(rendererInternals) {
4777
4860
  );
4778
4861
  }
4779
4862
  break;
4863
+ case VaporSlot:
4864
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
4865
+ vnode,
4866
+ node
4867
+ );
4868
+ break;
4780
4869
  default:
4781
4870
  if (shapeFlag & 1) {
4782
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
4871
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) {
4783
4872
  nextNode = onMismatch();
4784
4873
  } else {
4785
4874
  nextNode = hydrateElement(
@@ -4792,9 +4881,6 @@ function createHydrationFunctions(rendererInternals) {
4792
4881
  );
4793
4882
  }
4794
4883
  } else if (shapeFlag & 6) {
4795
- if (vnode.type.__vapor) {
4796
- throw new Error("Vapor component hydration is not supported yet.");
4797
- }
4798
4884
  vnode.slotScopeIds = slotScopeIds;
4799
4885
  const container = parentNode(node);
4800
4886
  if (isFragmentStart) {
@@ -4804,15 +4890,25 @@ function createHydrationFunctions(rendererInternals) {
4804
4890
  } else {
4805
4891
  nextNode = nextSibling(node);
4806
4892
  }
4807
- mountComponent(
4808
- vnode,
4809
- container,
4810
- null,
4811
- parentComponent,
4812
- parentSuspense,
4813
- getContainerType(container),
4814
- optimized
4815
- );
4893
+ if (vnode.type.__vapor) {
4894
+ getVaporInterface(parentComponent, vnode).hydrate(
4895
+ vnode,
4896
+ node,
4897
+ container,
4898
+ null,
4899
+ parentComponent
4900
+ );
4901
+ } else {
4902
+ mountComponent(
4903
+ vnode,
4904
+ container,
4905
+ null,
4906
+ parentComponent,
4907
+ parentSuspense,
4908
+ getContainerType(container),
4909
+ optimized
4910
+ );
4911
+ }
4816
4912
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4817
4913
  let subTree;
4818
4914
  if (isFragmentStart) {
@@ -4869,7 +4965,7 @@ function createHydrationFunctions(rendererInternals) {
4869
4965
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4870
4966
  }
4871
4967
  let needCallTransitionHooks = false;
4872
- if (isTemplateNode(el)) {
4968
+ if (isTemplateNode$1(el)) {
4873
4969
  needCallTransitionHooks = needTransition(
4874
4970
  null,
4875
4971
  // no need check parentSuspense in hydration
@@ -4897,7 +4993,7 @@ function createHydrationFunctions(rendererInternals) {
4897
4993
  );
4898
4994
  let hasWarned = false;
4899
4995
  while (next) {
4900
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4996
+ if (!isMismatchAllowed(el, 1)) {
4901
4997
  if (!hasWarned) {
4902
4998
  warn$1(
4903
4999
  `Hydration children mismatch on`,
@@ -4918,14 +5014,16 @@ Server rendered element contains more child nodes than client vdom.`
4918
5014
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4919
5015
  clientText = clientText.slice(1);
4920
5016
  }
4921
- if (el.textContent !== clientText) {
4922
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
5017
+ const { textContent } = el;
5018
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
5019
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
5020
+ if (!isMismatchAllowed(el, 0)) {
4923
5021
  warn$1(
4924
5022
  `Hydration text content mismatch on`,
4925
5023
  el,
4926
5024
  `
4927
- - rendered on server: ${el.textContent}
4928
- - expected on client: ${vnode.children}`
5025
+ - rendered on server: ${textContent}
5026
+ - expected on client: ${clientText}`
4929
5027
  );
4930
5028
  logMismatchError();
4931
5029
  }
@@ -5001,7 +5099,7 @@ Server rendered element contains more child nodes than client vdom.`
5001
5099
  } else if (isText && !vnode.children) {
5002
5100
  insert(vnode.el = createText(""), container);
5003
5101
  } else {
5004
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5102
+ if (!isMismatchAllowed(container, 1)) {
5005
5103
  if (!hasWarned) {
5006
5104
  warn$1(
5007
5105
  `Hydration children mismatch on`,
@@ -5051,7 +5149,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5051
5149
  }
5052
5150
  };
5053
5151
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5054
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5152
+ if (!isMismatchAllowed(node.parentElement, 1)) {
5055
5153
  warn$1(
5056
5154
  `Hydration node mismatch:
5057
5155
  - rendered on server:`,
@@ -5124,11 +5222,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5124
5222
  parent = parent.parent;
5125
5223
  }
5126
5224
  };
5127
- const isTemplateNode = (node) => {
5128
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
5129
- };
5130
5225
  return [hydrate, hydrateNode];
5131
5226
  }
5227
+ const isTemplateNode$1 = (node) => {
5228
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
5229
+ };
5132
5230
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5133
5231
  let mismatchType;
5134
5232
  let mismatchKey;
@@ -5143,7 +5241,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5143
5241
  }
5144
5242
  expected = normalizeClass(clientValue);
5145
5243
  if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
5146
- mismatchType = 2 /* CLASS */;
5244
+ mismatchType = 2;
5147
5245
  mismatchKey = `class`;
5148
5246
  }
5149
5247
  } else if (key === "style") {
@@ -5162,31 +5260,43 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5162
5260
  resolveCssVars(instance, vnode, expectedMap);
5163
5261
  }
5164
5262
  if (!isMapEqual(actualMap, expectedMap)) {
5165
- mismatchType = 3 /* STYLE */;
5263
+ mismatchType = 3;
5166
5264
  mismatchKey = "style";
5167
5265
  }
5168
- } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5169
- if (isBooleanAttr(key)) {
5170
- actual = el.hasAttribute(key);
5171
- expected = includeBooleanAttr(clientValue);
5172
- } else if (clientValue == null) {
5173
- actual = el.hasAttribute(key);
5174
- expected = false;
5175
- } else {
5176
- if (el.hasAttribute(key)) {
5177
- actual = el.getAttribute(key);
5178
- } else if (key === "value" && el.tagName === "TEXTAREA") {
5179
- actual = el.value;
5180
- } else {
5181
- actual = false;
5182
- }
5183
- expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5184
- }
5266
+ } else if (isValidHtmlOrSvgAttribute(el, key)) {
5267
+ ({ actual, expected } = getAttributeMismatch(el, key, clientValue));
5185
5268
  if (actual !== expected) {
5186
- mismatchType = 4 /* ATTRIBUTE */;
5269
+ mismatchType = 4;
5187
5270
  mismatchKey = key;
5188
5271
  }
5189
5272
  }
5273
+ return warnPropMismatch(el, mismatchKey, mismatchType, actual, expected);
5274
+ }
5275
+ function getAttributeMismatch(el, key, clientValue) {
5276
+ let actual;
5277
+ let expected;
5278
+ if (isBooleanAttr(key)) {
5279
+ actual = el.hasAttribute(key);
5280
+ expected = includeBooleanAttr(clientValue);
5281
+ } else if (clientValue == null) {
5282
+ actual = el.hasAttribute(key);
5283
+ expected = false;
5284
+ } else {
5285
+ if (el.hasAttribute(key)) {
5286
+ actual = el.getAttribute(key);
5287
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
5288
+ actual = el.value;
5289
+ } else {
5290
+ actual = false;
5291
+ }
5292
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5293
+ }
5294
+ return { actual, expected };
5295
+ }
5296
+ function isValidHtmlOrSvgAttribute(el, key) {
5297
+ return el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key));
5298
+ }
5299
+ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
5190
5300
  if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
5191
5301
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
5192
5302
  const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
@@ -5258,14 +5368,14 @@ function resolveCssVars(instance, vnode, expectedMap) {
5258
5368
  }
5259
5369
  const allowMismatchAttr = "data-allow-mismatch";
5260
5370
  const MismatchTypeString = {
5261
- [0 /* TEXT */]: "text",
5262
- [1 /* CHILDREN */]: "children",
5263
- [2 /* CLASS */]: "class",
5264
- [3 /* STYLE */]: "style",
5265
- [4 /* ATTRIBUTE */]: "attribute"
5371
+ [0]: "text",
5372
+ [1]: "children",
5373
+ [2]: "class",
5374
+ [3]: "style",
5375
+ [4]: "attribute"
5266
5376
  };
5267
5377
  function isMismatchAllowed(el, allowedType) {
5268
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
5378
+ if (allowedType === 0 || allowedType === 1) {
5269
5379
  while (el && !el.hasAttribute(allowMismatchAttr)) {
5270
5380
  el = el.parentElement;
5271
5381
  }
@@ -5277,7 +5387,7 @@ function isMismatchAllowed(el, allowedType) {
5277
5387
  return true;
5278
5388
  } else {
5279
5389
  const list = allowedAttr.split(",");
5280
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
5390
+ if (allowedType === 0 && list.includes("children")) {
5281
5391
  return true;
5282
5392
  }
5283
5393
  return list.includes(MismatchTypeString[allowedType]);
@@ -5334,7 +5444,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
5334
5444
  hasHydrated = true;
5335
5445
  teardown();
5336
5446
  hydrate();
5337
- e.target.dispatchEvent(new e.constructor(e.type, e));
5447
+ if (!(`$evt${e.type}` in e.target)) {
5448
+ e.target.dispatchEvent(new e.constructor(e.type, e));
5449
+ }
5338
5450
  }
5339
5451
  };
5340
5452
  const teardown = () => {
@@ -5376,104 +5488,46 @@ function forEachElement(node, cb) {
5376
5488
  }
5377
5489
 
5378
5490
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
5379
- /*! #__NO_SIDE_EFFECTS__ */
5380
5491
  // @__NO_SIDE_EFFECTS__
5381
5492
  function defineAsyncComponent(source) {
5382
- if (isFunction(source)) {
5383
- source = { loader: source };
5384
- }
5385
5493
  const {
5386
- loader,
5387
- loadingComponent,
5388
- errorComponent,
5389
- delay = 200,
5390
- hydrate: hydrateStrategy,
5391
- timeout,
5392
- // undefined = never times out
5393
- suspensible = true,
5394
- onError: userOnError
5395
- } = source;
5396
- let pendingRequest = null;
5397
- let resolvedComp;
5398
- let retries = 0;
5399
- const retry = () => {
5400
- retries++;
5401
- pendingRequest = null;
5402
- return load();
5403
- };
5404
- const load = () => {
5405
- let thisRequest;
5406
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5407
- err = err instanceof Error ? err : new Error(String(err));
5408
- if (userOnError) {
5409
- return new Promise((resolve, reject) => {
5410
- const userRetry = () => resolve(retry());
5411
- const userFail = () => reject(err);
5412
- userOnError(err, userRetry, userFail, retries + 1);
5413
- });
5414
- } else {
5415
- throw err;
5416
- }
5417
- }).then((comp) => {
5418
- if (thisRequest !== pendingRequest && pendingRequest) {
5419
- return pendingRequest;
5420
- }
5421
- if (!comp) {
5422
- warn$1(
5423
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5424
- );
5425
- }
5426
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5427
- comp = comp.default;
5428
- }
5429
- if (comp && !isObject(comp) && !isFunction(comp)) {
5430
- throw new Error(`Invalid async component load result: ${comp}`);
5431
- }
5432
- resolvedComp = comp;
5433
- return comp;
5434
- }));
5435
- };
5494
+ load,
5495
+ getResolvedComp,
5496
+ setPendingRequest,
5497
+ source: {
5498
+ loadingComponent,
5499
+ errorComponent,
5500
+ delay,
5501
+ hydrate: hydrateStrategy,
5502
+ timeout,
5503
+ suspensible = true
5504
+ }
5505
+ } = createAsyncComponentContext(source);
5436
5506
  return defineComponent({
5437
5507
  name: "AsyncComponentWrapper",
5438
5508
  __asyncLoader: load,
5439
5509
  __asyncHydrate(el, instance, hydrate) {
5440
- let patched = false;
5441
- const doHydrate = hydrateStrategy ? () => {
5442
- const performHydrate = () => {
5443
- if (patched) {
5444
- warn$1(
5445
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5446
- );
5447
- return;
5448
- }
5449
- hydrate();
5450
- };
5451
- const teardown = hydrateStrategy(
5452
- performHydrate,
5453
- (cb) => forEachElement(el, cb)
5454
- );
5455
- if (teardown) {
5456
- (instance.bum || (instance.bum = [])).push(teardown);
5457
- }
5458
- (instance.u || (instance.u = [])).push(() => patched = true);
5459
- } : hydrate;
5460
- if (resolvedComp) {
5461
- doHydrate();
5462
- } else {
5463
- load().then(() => !instance.isUnmounted && doHydrate());
5464
- }
5510
+ performAsyncHydrate(
5511
+ el,
5512
+ instance,
5513
+ hydrate,
5514
+ getResolvedComp,
5515
+ load,
5516
+ hydrateStrategy
5517
+ );
5465
5518
  },
5466
5519
  get __asyncResolved() {
5467
- return resolvedComp;
5520
+ return getResolvedComp();
5468
5521
  },
5469
5522
  setup() {
5470
5523
  const instance = currentInstance;
5471
5524
  markAsyncBoundary(instance);
5525
+ let resolvedComp = getResolvedComp();
5472
5526
  if (resolvedComp) {
5473
5527
  return () => createInnerComp(resolvedComp, instance);
5474
5528
  }
5475
5529
  const onError = (err) => {
5476
- pendingRequest = null;
5530
+ setPendingRequest(null);
5477
5531
  handleError(
5478
5532
  err,
5479
5533
  instance,
@@ -5491,25 +5545,11 @@ function defineAsyncComponent(source) {
5491
5545
  }) : null;
5492
5546
  });
5493
5547
  }
5494
- const loaded = ref(false);
5495
- const error = ref();
5496
- const delayed = ref(!!delay);
5497
- if (delay) {
5498
- setTimeout(() => {
5499
- delayed.value = false;
5500
- }, delay);
5501
- }
5502
- if (timeout != null) {
5503
- setTimeout(() => {
5504
- if (!loaded.value && !error.value) {
5505
- const err = new Error(
5506
- `Async component timed out after ${timeout}ms.`
5507
- );
5508
- onError(err);
5509
- error.value = err;
5510
- }
5511
- }, timeout);
5512
- }
5548
+ const { loaded, error, delayed } = useAsyncComponentState(
5549
+ delay,
5550
+ timeout,
5551
+ onError
5552
+ );
5513
5553
  load().then(() => {
5514
5554
  loaded.value = true;
5515
5555
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -5520,6 +5560,7 @@ function defineAsyncComponent(source) {
5520
5560
  error.value = err;
5521
5561
  });
5522
5562
  return () => {
5563
+ resolvedComp = getResolvedComp();
5523
5564
  if (loaded.value && resolvedComp) {
5524
5565
  return createInnerComp(resolvedComp, instance);
5525
5566
  } else if (error.value && errorComponent) {
@@ -5527,7 +5568,10 @@ function defineAsyncComponent(source) {
5527
5568
  error: error.value
5528
5569
  });
5529
5570
  } else if (loadingComponent && !delayed.value) {
5530
- return createVNode(loadingComponent);
5571
+ return createInnerComp(
5572
+ loadingComponent,
5573
+ instance
5574
+ );
5531
5575
  }
5532
5576
  };
5533
5577
  }
@@ -5541,6 +5585,108 @@ function createInnerComp(comp, parent) {
5541
5585
  delete parent.vnode.ce;
5542
5586
  return vnode;
5543
5587
  }
5588
+ function createAsyncComponentContext(source) {
5589
+ if (isFunction(source)) {
5590
+ source = { loader: source };
5591
+ }
5592
+ const { loader, onError: userOnError } = source;
5593
+ let pendingRequest = null;
5594
+ let resolvedComp;
5595
+ let retries = 0;
5596
+ const retry = () => {
5597
+ retries++;
5598
+ pendingRequest = null;
5599
+ return load();
5600
+ };
5601
+ const load = () => {
5602
+ let thisRequest;
5603
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5604
+ err = err instanceof Error ? err : new Error(String(err));
5605
+ if (userOnError) {
5606
+ return new Promise((resolve, reject) => {
5607
+ const userRetry = () => resolve(retry());
5608
+ const userFail = () => reject(err);
5609
+ userOnError(err, userRetry, userFail, retries + 1);
5610
+ });
5611
+ } else {
5612
+ throw err;
5613
+ }
5614
+ }).then((comp) => {
5615
+ if (thisRequest !== pendingRequest && pendingRequest) {
5616
+ return pendingRequest;
5617
+ }
5618
+ if (!comp) {
5619
+ warn$1(
5620
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5621
+ );
5622
+ }
5623
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5624
+ comp = comp.default;
5625
+ }
5626
+ if (comp && !isObject(comp) && !isFunction(comp)) {
5627
+ throw new Error(`Invalid async component load result: ${comp}`);
5628
+ }
5629
+ resolvedComp = comp;
5630
+ return comp;
5631
+ }));
5632
+ };
5633
+ return {
5634
+ load,
5635
+ source,
5636
+ getResolvedComp: () => resolvedComp,
5637
+ setPendingRequest: (request) => pendingRequest = request
5638
+ };
5639
+ }
5640
+ const useAsyncComponentState = (delay, timeout, onError) => {
5641
+ const loaded = ref(false);
5642
+ const error = ref();
5643
+ const delayed = ref(!!delay);
5644
+ if (delay) {
5645
+ setTimeout(() => {
5646
+ delayed.value = false;
5647
+ }, delay);
5648
+ }
5649
+ if (timeout != null) {
5650
+ setTimeout(() => {
5651
+ if (!loaded.value && !error.value) {
5652
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
5653
+ onError(err);
5654
+ error.value = err;
5655
+ }
5656
+ }, timeout);
5657
+ }
5658
+ return { loaded, error, delayed };
5659
+ };
5660
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
5661
+ let patched = false;
5662
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5663
+ const performHydrate = () => {
5664
+ if (patched) {
5665
+ {
5666
+ const resolvedComp = getResolvedComp();
5667
+ warn$1(
5668
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5669
+ );
5670
+ }
5671
+ return;
5672
+ }
5673
+ hydrate();
5674
+ };
5675
+ const doHydrate = hydrateStrategy ? () => {
5676
+ const teardown = hydrateStrategy(
5677
+ performHydrate,
5678
+ (cb) => forEachElement(el, cb)
5679
+ );
5680
+ if (teardown) {
5681
+ (instance.bum || (instance.bum = [])).push(teardown);
5682
+ }
5683
+ } : performHydrate;
5684
+ if (getResolvedComp()) {
5685
+ doHydrate();
5686
+ } else {
5687
+ load().then(() => !instance.isUnmounted && doHydrate());
5688
+ }
5689
+ }
5544
5690
 
5545
5691
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5546
5692
  const KeepAliveImpl = {
@@ -5570,83 +5716,37 @@ const KeepAliveImpl = {
5570
5716
  keepAliveInstance.__v_cache = cache;
5571
5717
  }
5572
5718
  const parentSuspense = keepAliveInstance.suspense;
5719
+ const { renderer } = sharedContext;
5573
5720
  const {
5574
- renderer: {
5575
- p: patch,
5576
- m: move,
5577
- um: _unmount,
5578
- o: { createElement }
5579
- }
5580
- } = sharedContext;
5721
+ um: _unmount,
5722
+ o: { createElement }
5723
+ } = renderer;
5581
5724
  const storageContainer = createElement("div");
5725
+ sharedContext.getStorageContainer = () => storageContainer;
5726
+ sharedContext.getCachedComponent = (vnode) => {
5727
+ const key = vnode.key == null ? vnode.type : vnode.key;
5728
+ return cache.get(key);
5729
+ };
5582
5730
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
5583
- const instance = vnode.component;
5584
- move(
5731
+ activate(
5585
5732
  vnode,
5586
5733
  container,
5587
5734
  anchor,
5588
- 0,
5735
+ renderer,
5589
5736
  keepAliveInstance,
5590
- parentSuspense
5591
- );
5592
- patch(
5593
- instance.vnode,
5594
- vnode,
5595
- container,
5596
- anchor,
5597
- instance,
5598
5737
  parentSuspense,
5599
5738
  namespace,
5600
- vnode.slotScopeIds,
5601
5739
  optimized
5602
5740
  );
5603
- queuePostRenderEffect(
5604
- () => {
5605
- instance.isDeactivated = false;
5606
- if (instance.a) {
5607
- invokeArrayFns(instance.a);
5608
- }
5609
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5610
- if (vnodeHook) {
5611
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5612
- }
5613
- },
5614
- void 0,
5615
- parentSuspense
5616
- );
5617
- {
5618
- devtoolsComponentAdded(instance);
5619
- }
5620
5741
  };
5621
5742
  sharedContext.deactivate = (vnode) => {
5622
- const instance = vnode.component;
5623
- invalidateMount(instance.m);
5624
- invalidateMount(instance.a);
5625
- move(
5743
+ deactivate(
5626
5744
  vnode,
5627
5745
  storageContainer,
5628
- null,
5629
- 1,
5746
+ renderer,
5630
5747
  keepAliveInstance,
5631
5748
  parentSuspense
5632
5749
  );
5633
- queuePostRenderEffect(
5634
- () => {
5635
- if (instance.da) {
5636
- invokeArrayFns(instance.da);
5637
- }
5638
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5639
- if (vnodeHook) {
5640
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5641
- }
5642
- instance.isDeactivated = true;
5643
- },
5644
- void 0,
5645
- parentSuspense
5646
- );
5647
- {
5648
- devtoolsComponentAdded(instance);
5649
- }
5650
5750
  };
5651
5751
  function unmount(vnode) {
5652
5752
  resetShapeFlag(vnode);
@@ -5797,7 +5897,7 @@ function onActivated(hook, target) {
5797
5897
  function onDeactivated(hook, target) {
5798
5898
  registerKeepAliveHook(hook, "da", target);
5799
5899
  }
5800
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5900
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
5801
5901
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
5802
5902
  let current = target;
5803
5903
  while (current) {
@@ -5811,8 +5911,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5811
5911
  injectHook(type, wrappedHook, target);
5812
5912
  if (target) {
5813
5913
  let current = target.parent;
5814
- while (current && current.parent && current.parent.vnode) {
5815
- if (isKeepAlive(current.parent.vnode)) {
5914
+ while (current && current.parent) {
5915
+ let parent = current.parent;
5916
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
5816
5917
  injectToKeepAliveRoot(wrappedHook, type, target, current);
5817
5918
  }
5818
5919
  current = current.parent;
@@ -5838,6 +5939,68 @@ function resetShapeFlag(vnode) {
5838
5939
  function getInnerChild(vnode) {
5839
5940
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
5840
5941
  }
5942
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
5943
+ const instance = vnode.component;
5944
+ move(
5945
+ vnode,
5946
+ container,
5947
+ anchor,
5948
+ 0,
5949
+ parentComponent,
5950
+ parentSuspense
5951
+ );
5952
+ patch(
5953
+ instance.vnode,
5954
+ vnode,
5955
+ container,
5956
+ anchor,
5957
+ instance,
5958
+ parentSuspense,
5959
+ namespace,
5960
+ vnode.slotScopeIds,
5961
+ optimized
5962
+ );
5963
+ queuePostRenderEffect(
5964
+ () => {
5965
+ instance.isDeactivated = false;
5966
+ if (instance.a) {
5967
+ invokeArrayFns(instance.a);
5968
+ }
5969
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5970
+ if (vnodeHook) {
5971
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5972
+ }
5973
+ },
5974
+ void 0,
5975
+ parentSuspense
5976
+ );
5977
+ {
5978
+ devtoolsComponentAdded(instance);
5979
+ }
5980
+ }
5981
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
5982
+ const instance = vnode.component;
5983
+ invalidateMount(instance.m);
5984
+ invalidateMount(instance.a);
5985
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
5986
+ queuePostRenderEffect(
5987
+ () => {
5988
+ if (instance.da) {
5989
+ invokeArrayFns(instance.da);
5990
+ }
5991
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5992
+ if (vnodeHook) {
5993
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5994
+ }
5995
+ instance.isDeactivated = true;
5996
+ },
5997
+ void 0,
5998
+ parentSuspense
5999
+ );
6000
+ {
6001
+ devtoolsComponentAdded(instance);
6002
+ }
6003
+ }
5841
6004
 
5842
6005
  function injectHook(type, hook, target = currentInstance, prepend = false) {
5843
6006
  if (target) {
@@ -6313,12 +6476,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6313
6476
  return ret;
6314
6477
  }
6315
6478
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
6479
+ const hasProps = Object.keys(props).length > 0;
6316
6480
  if (name !== "default") props.name = name;
6317
6481
  return openBlock(), createBlock(
6318
6482
  Fragment,
6319
6483
  null,
6320
6484
  [createVNode("slot", props, fallback && fallback())],
6321
- 64
6485
+ hasProps ? -2 : 64
6322
6486
  );
6323
6487
  }
6324
6488
  if (slot && slot.length > 1) {
@@ -6332,6 +6496,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6332
6496
  }
6333
6497
  openBlock();
6334
6498
  const validSlotContent = slot && ensureValidVNode(slot(props));
6499
+ ensureVaporSlotFallback(validSlotContent, fallback);
6335
6500
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6336
6501
  // key attached in the `createSlots` helper, respect that
6337
6502
  validSlotContent && validSlotContent.key;
@@ -6361,6 +6526,14 @@ function ensureValidVNode(vnodes) {
6361
6526
  return true;
6362
6527
  }) ? vnodes : null;
6363
6528
  }
6529
+ function ensureVaporSlotFallback(vnodes, fallback) {
6530
+ let vaporSlot;
6531
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
6532
+ if (!vaporSlot.fallback && fallback) {
6533
+ vaporSlot.fallback = fallback;
6534
+ }
6535
+ }
6536
+ }
6364
6537
 
6365
6538
  function toHandlers(obj, preserveCaseIfNecessary) {
6366
6539
  const ret = {};
@@ -6422,7 +6595,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
6422
6595
  }
6423
6596
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
6424
6597
  }
6425
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
6598
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
6426
6599
  return createSlots(
6427
6600
  raw || { $stable: !hasDynamicKeys },
6428
6601
  mapKeyToName(fns)
@@ -6589,7 +6762,7 @@ function installCompatInstanceProperties(map) {
6589
6762
  _b: () => legacyBindObjectProps,
6590
6763
  _v: () => createTextVNode,
6591
6764
  _e: () => createCommentVNode,
6592
- _u: () => legacyresolveScopedSlots,
6765
+ _u: () => legacyResolveScopedSlots,
6593
6766
  _g: () => legacyBindObjectListeners,
6594
6767
  _d: () => legacyBindDynamicKeys,
6595
6768
  _p: () => legacyPrependModifier
@@ -6761,10 +6934,10 @@ const PublicInstanceProxyHandlers = {
6761
6934
  return true;
6762
6935
  },
6763
6936
  has({
6764
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6937
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6765
6938
  }, key) {
6766
- let normalizedProps;
6767
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
6939
+ let normalizedProps, cssModules;
6940
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
6768
6941
  },
6769
6942
  defineProperty(target, key, descriptor) {
6770
6943
  if (descriptor.get != null) {
@@ -6916,15 +7089,15 @@ function withDefaults(props, defaults) {
6916
7089
  return null;
6917
7090
  }
6918
7091
  function useSlots() {
6919
- return getContext().slots;
7092
+ return getContext("useSlots").slots;
6920
7093
  }
6921
7094
  function useAttrs() {
6922
- return getContext().attrs;
7095
+ return getContext("useAttrs").attrs;
6923
7096
  }
6924
- function getContext() {
7097
+ function getContext(calledFunctionName) {
6925
7098
  const i = getCurrentGenericInstance();
6926
7099
  if (!i) {
6927
- warn$1(`useContext() called without active instance.`);
7100
+ warn$1(`${calledFunctionName}() called without active instance.`);
6928
7101
  }
6929
7102
  if (i.vapor) {
6930
7103
  return i;
@@ -7188,7 +7361,8 @@ function applyOptions(instance) {
7188
7361
  expose.forEach((key) => {
7189
7362
  Object.defineProperty(exposed, key, {
7190
7363
  get: () => publicThis[key],
7191
- set: (val) => publicThis[key] = val
7364
+ set: (val) => publicThis[key] = val,
7365
+ enumerable: true
7192
7366
  });
7193
7367
  });
7194
7368
  } else if (!instance.exposed) {
@@ -7514,7 +7688,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7514
7688
  return vm;
7515
7689
  }
7516
7690
  }
7517
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.2"}`;
7691
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.3"}`;
7518
7692
  Vue.config = singletonApp.config;
7519
7693
  Vue.use = (plugin, ...options) => {
7520
7694
  if (plugin && isFunction(plugin.install)) {
@@ -7528,22 +7702,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7528
7702
  singletonApp.mixin(m);
7529
7703
  return Vue;
7530
7704
  };
7531
- Vue.component = (name, comp) => {
7705
+ Vue.component = ((name, comp) => {
7532
7706
  if (comp) {
7533
7707
  singletonApp.component(name, comp);
7534
7708
  return Vue;
7535
7709
  } else {
7536
7710
  return singletonApp.component(name);
7537
7711
  }
7538
- };
7539
- Vue.directive = (name, dir) => {
7712
+ });
7713
+ Vue.directive = ((name, dir) => {
7540
7714
  if (dir) {
7541
7715
  singletonApp.directive(name, dir);
7542
7716
  return Vue;
7543
7717
  } else {
7544
7718
  return singletonApp.directive(name);
7545
7719
  }
7546
- };
7720
+ });
7547
7721
  Vue.options = { _base: Vue };
7548
7722
  let cid = 1;
7549
7723
  Vue.cid = cid;
@@ -7606,14 +7780,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7606
7780
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7607
7781
  return reactive(target);
7608
7782
  };
7609
- Vue.filter = (name, filter) => {
7783
+ Vue.filter = ((name, filter) => {
7610
7784
  if (filter) {
7611
7785
  singletonApp.filter(name, filter);
7612
7786
  return Vue;
7613
7787
  } else {
7614
7788
  return singletonApp.filter(name);
7615
7789
  }
7616
- };
7790
+ });
7617
7791
  const util = {
7618
7792
  warn: warn$1 ,
7619
7793
  extend,
@@ -7772,7 +7946,7 @@ function installCompatMount(app, context, render) {
7772
7946
  {
7773
7947
  for (let i = 0; i < container.attributes.length; i++) {
7774
7948
  const attr = container.attributes[i];
7775
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7949
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
7776
7950
  warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7777
7951
  break;
7778
7952
  }
@@ -8606,7 +8780,7 @@ function isBoolean(...args) {
8606
8780
  return args.some((elem) => elem.toLowerCase() === "boolean");
8607
8781
  }
8608
8782
 
8609
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8783
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8610
8784
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8611
8785
  const normalizeSlot = (key, rawSlot, ctx) => {
8612
8786
  if (rawSlot._n) {
@@ -8660,8 +8834,6 @@ const assignSlots = (slots, children, optimized) => {
8660
8834
  const initSlots = (instance, children, optimized) => {
8661
8835
  const slots = instance.slots = createInternalObject();
8662
8836
  if (instance.vnode.shapeFlag & 32) {
8663
- const cacheIndexes = children.__;
8664
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8665
8837
  const type = children._;
8666
8838
  if (type) {
8667
8839
  assignSlots(slots, children, optimized);
@@ -8725,12 +8897,10 @@ function endMeasure(instance, type) {
8725
8897
  if (instance.appContext.config.performance && isSupported()) {
8726
8898
  const startTag = `vue-${type}-${instance.uid}`;
8727
8899
  const endTag = startTag + `:end`;
8900
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8728
8901
  perf.mark(endTag);
8729
- perf.measure(
8730
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8731
- startTag,
8732
- endTag
8733
- );
8902
+ perf.measure(measureName, startTag, endTag);
8903
+ perf.clearMeasures(measureName);
8734
8904
  perf.clearMarks(startTag);
8735
8905
  perf.clearMarks(endTag);
8736
8906
  }
@@ -8969,15 +9139,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8969
9139
  optimized
8970
9140
  );
8971
9141
  } else {
8972
- patchElement(
8973
- n1,
8974
- n2,
8975
- parentComponent,
8976
- parentSuspense,
8977
- namespace,
8978
- slotScopeIds,
8979
- optimized
8980
- );
9142
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9143
+ try {
9144
+ if (customElement) {
9145
+ customElement._beginPatch();
9146
+ }
9147
+ patchElement(
9148
+ n1,
9149
+ n2,
9150
+ parentComponent,
9151
+ parentSuspense,
9152
+ namespace,
9153
+ slotScopeIds,
9154
+ optimized
9155
+ );
9156
+ } finally {
9157
+ if (customElement) {
9158
+ customElement._endPatch();
9159
+ }
9160
+ }
8981
9161
  }
8982
9162
  };
8983
9163
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -9028,16 +9208,20 @@ function baseCreateRenderer(options, createHydrationFns) {
9028
9208
  if (dirs) {
9029
9209
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
9030
9210
  }
9031
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
9032
- if (needCallTransitionHooks) {
9033
- transition.beforeEnter(el);
9211
+ if (transition) {
9212
+ performTransitionEnter(
9213
+ el,
9214
+ transition,
9215
+ () => hostInsert(el, container, anchor),
9216
+ parentSuspense
9217
+ );
9218
+ } else {
9219
+ hostInsert(el, container, anchor);
9034
9220
  }
9035
- hostInsert(el, container, anchor);
9036
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
9221
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
9037
9222
  queuePostRenderEffect(
9038
9223
  () => {
9039
9224
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
9040
- needCallTransitionHooks && transition.enter(el);
9041
9225
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
9042
9226
  },
9043
9227
  void 0,
@@ -9054,21 +9238,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9054
9238
  hostSetScopeId(el, slotScopeIds[i]);
9055
9239
  }
9056
9240
  }
9057
- let subTree = parentComponent && parentComponent.subTree;
9058
- if (subTree) {
9059
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
9060
- subTree = filterSingleRoot(subTree.children) || subTree;
9061
- }
9062
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
9063
- const parentVNode = parentComponent.vnode;
9064
- setScopeId(
9065
- el,
9066
- parentVNode,
9067
- parentVNode.scopeId,
9068
- parentVNode.slotScopeIds,
9069
- parentComponent.parent
9070
- );
9071
- }
9241
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
9242
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
9243
+ hostSetScopeId(el, inheritedScopeIds[i]);
9072
9244
  }
9073
9245
  };
9074
9246
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -9309,12 +9481,21 @@ function baseCreateRenderer(options, createHydrationFns) {
9309
9481
  n2.slotScopeIds = slotScopeIds;
9310
9482
  if (n2.type.__vapor) {
9311
9483
  if (n1 == null) {
9312
- getVaporInterface(parentComponent, n2).mount(
9313
- n2,
9314
- container,
9315
- anchor,
9316
- parentComponent
9317
- );
9484
+ if (n2.shapeFlag & 512) {
9485
+ getVaporInterface(parentComponent, n2).activate(
9486
+ n2,
9487
+ container,
9488
+ anchor,
9489
+ parentComponent
9490
+ );
9491
+ } else {
9492
+ getVaporInterface(parentComponent, n2).mount(
9493
+ n2,
9494
+ container,
9495
+ anchor,
9496
+ parentComponent
9497
+ );
9498
+ }
9318
9499
  } else {
9319
9500
  getVaporInterface(parentComponent, n2).update(
9320
9501
  n1,
@@ -9378,6 +9559,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9378
9559
  if (!initialVNode.el) {
9379
9560
  const placeholder = instance.subTree = createVNode(Comment);
9380
9561
  processCommentNode(null, placeholder, container, anchor);
9562
+ initialVNode.placeholder = placeholder.el;
9381
9563
  }
9382
9564
  } else {
9383
9565
  setupRenderEffect(
@@ -9945,7 +10127,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9945
10127
  for (i = toBePatched - 1; i >= 0; i--) {
9946
10128
  const nextIndex = s2 + i;
9947
10129
  const nextChild = c2[nextIndex];
9948
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
10130
+ const anchorVNode = c2[nextIndex + 1];
10131
+ const anchor = nextIndex + 1 < l2 ? (
10132
+ // #13559, fallback to el placeholder for unresolved async component
10133
+ anchorVNode.el || anchorVNode.placeholder
10134
+ ) : parentAnchor;
9949
10135
  if (newIndexToOldIndexMap[i] === 0) {
9950
10136
  patch(
9951
10137
  null,
@@ -10025,12 +10211,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10025
10211
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10026
10212
  if (needTransition2) {
10027
10213
  if (moveType === 0) {
10028
- transition.beforeEnter(el);
10029
- hostInsert(el, container, anchor);
10030
- queuePostRenderEffect(
10031
- () => transition.enter(el),
10032
- void 0,
10033
- parentSuspense
10214
+ performTransitionEnter(
10215
+ el,
10216
+ transition,
10217
+ () => hostInsert(el, container, anchor),
10218
+ parentSuspense,
10219
+ true
10034
10220
  );
10035
10221
  } else {
10036
10222
  const { leave, delayLeave, afterLeave } = transition;
@@ -10042,6 +10228,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10042
10228
  }
10043
10229
  };
10044
10230
  const performLeave = () => {
10231
+ if (el._isLeaving) {
10232
+ el[leaveCbKey](
10233
+ true
10234
+ /* cancelled */
10235
+ );
10236
+ }
10045
10237
  leave(el, () => {
10046
10238
  remove2();
10047
10239
  afterLeave && afterLeave();
@@ -10081,7 +10273,14 @@ function baseCreateRenderer(options, createHydrationFns) {
10081
10273
  parentComponent.renderCache[cacheIndex] = void 0;
10082
10274
  }
10083
10275
  if (shapeFlag & 256) {
10084
- parentComponent.ctx.deactivate(vnode);
10276
+ if (vnode.type.__vapor) {
10277
+ getVaporInterface(parentComponent, vnode).deactivate(
10278
+ vnode,
10279
+ parentComponent.ctx.getStorageContainer()
10280
+ );
10281
+ } else {
10282
+ parentComponent.ctx.deactivate(vnode);
10283
+ }
10085
10284
  return;
10086
10285
  }
10087
10286
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -10169,22 +10368,15 @@ function baseCreateRenderer(options, createHydrationFns) {
10169
10368
  removeStaticNode(vnode);
10170
10369
  return;
10171
10370
  }
10172
- const performRemove = () => {
10173
- hostRemove(el);
10174
- if (transition && !transition.persisted && transition.afterLeave) {
10175
- transition.afterLeave();
10176
- }
10177
- };
10178
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
10179
- const { leave, delayLeave } = transition;
10180
- const performLeave = () => leave(el, performRemove);
10181
- if (delayLeave) {
10182
- delayLeave(vnode.el, performRemove, performLeave);
10183
- } else {
10184
- performLeave();
10185
- }
10371
+ if (transition) {
10372
+ performTransitionLeave(
10373
+ el,
10374
+ transition,
10375
+ () => hostRemove(el),
10376
+ !!(vnode.shapeFlag & 1)
10377
+ );
10186
10378
  } else {
10187
- performRemove();
10379
+ hostRemove(el);
10188
10380
  }
10189
10381
  };
10190
10382
  const removeFragment = (cur, end) => {
@@ -10200,27 +10392,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10200
10392
  if (instance.type.__hmrId) {
10201
10393
  unregisterHMR(instance);
10202
10394
  }
10203
- const {
10204
- bum,
10205
- scope,
10206
- effect,
10207
- subTree,
10208
- um,
10209
- m,
10210
- a,
10211
- parent,
10212
- slots: { __: slotCacheKeys }
10213
- } = instance;
10395
+ const { bum, scope, effect, subTree, um, m, a } = instance;
10214
10396
  invalidateMount(m);
10215
10397
  invalidateMount(a);
10216
10398
  if (bum) {
10217
10399
  invokeArrayFns(bum);
10218
10400
  }
10219
- if (parent && isArray(slotCacheKeys)) {
10220
- slotCacheKeys.forEach((v) => {
10221
- parent.renderCache[v] = void 0;
10222
- });
10223
- }
10224
10401
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
10225
10402
  instance.emit("hook:beforeDestroy");
10226
10403
  }
@@ -10244,12 +10421,6 @@ function baseCreateRenderer(options, createHydrationFns) {
10244
10421
  void 0,
10245
10422
  parentSuspense
10246
10423
  );
10247
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
10248
- parentSuspense.deps--;
10249
- if (parentSuspense.deps === 0) {
10250
- parentSuspense.resolve();
10251
- }
10252
- }
10253
10424
  {
10254
10425
  devtoolsComponentRemoved(instance);
10255
10426
  }
@@ -10262,7 +10433,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10262
10433
  const getNextHostNode = (vnode) => {
10263
10434
  if (vnode.shapeFlag & 6) {
10264
10435
  if (vnode.type.__vapor) {
10265
- return hostNextSibling(vnode.component.block);
10436
+ return hostNextSibling(vnode.anchor);
10266
10437
  }
10267
10438
  return getNextHostNode(vnode.component.subTree);
10268
10439
  }
@@ -10340,6 +10511,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10340
10511
  return {
10341
10512
  render,
10342
10513
  hydrate,
10514
+ hydrateNode,
10343
10515
  internals,
10344
10516
  createApp: createAppAPI(
10345
10517
  mountApp,
@@ -10381,7 +10553,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
10381
10553
  if (!shallow && c2.patchFlag !== -2)
10382
10554
  traverseStaticChildren(c1, c2);
10383
10555
  }
10384
- if (c2.type === Text) {
10556
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
10557
+ c2.patchFlag !== -1) {
10385
10558
  c2.el = c1.el;
10386
10559
  }
10387
10560
  if (c2.type === Comment && !c2.el) {
@@ -10394,7 +10567,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
10394
10567
  }
10395
10568
  }
10396
10569
  function locateNonHydratedAsyncRoot(instance) {
10397
- const subComponent = instance.vapor ? null : instance.subTree.component;
10570
+ const subComponent = instance.subTree && instance.subTree.component;
10398
10571
  if (subComponent) {
10399
10572
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
10400
10573
  return subComponent;
@@ -10409,6 +10582,34 @@ function invalidateMount(hooks) {
10409
10582
  hooks[i].flags |= 4;
10410
10583
  }
10411
10584
  }
10585
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
10586
+ if (force || needTransition(parentSuspense, transition)) {
10587
+ transition.beforeEnter(el);
10588
+ insert();
10589
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
10590
+ } else {
10591
+ insert();
10592
+ }
10593
+ }
10594
+ function performTransitionLeave(el, transition, remove, isElement = true) {
10595
+ const performRemove = () => {
10596
+ remove();
10597
+ if (transition && !transition.persisted && transition.afterLeave) {
10598
+ transition.afterLeave();
10599
+ }
10600
+ };
10601
+ if (isElement && transition && !transition.persisted) {
10602
+ const { leave, delayLeave } = transition;
10603
+ const performLeave = () => leave(el, performRemove);
10604
+ if (delayLeave) {
10605
+ delayLeave(el, performRemove, performLeave);
10606
+ } else {
10607
+ performLeave();
10608
+ }
10609
+ } else {
10610
+ performRemove();
10611
+ }
10612
+ }
10412
10613
  function getVaporInterface(instance, vnode) {
10413
10614
  const ctx = instance ? instance.appContext : vnode.appContext;
10414
10615
  const res = ctx && ctx.vapor;
@@ -10423,6 +10624,32 @@ app.use(vaporInteropPlugin)
10423
10624
  }
10424
10625
  return res;
10425
10626
  }
10627
+ function getInheritedScopeIds(vnode, parentComponent) {
10628
+ const inheritedScopeIds = [];
10629
+ let currentParent = parentComponent;
10630
+ let currentVNode = vnode;
10631
+ while (currentParent) {
10632
+ let subTree = currentParent.subTree;
10633
+ if (!subTree) break;
10634
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
10635
+ subTree = filterSingleRoot(subTree.children) || subTree;
10636
+ }
10637
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
10638
+ const parentVNode = currentParent.vnode;
10639
+ if (parentVNode.scopeId) {
10640
+ inheritedScopeIds.push(parentVNode.scopeId);
10641
+ }
10642
+ if (parentVNode.slotScopeIds) {
10643
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
10644
+ }
10645
+ currentVNode = parentVNode;
10646
+ currentParent = currentParent.parent;
10647
+ } else {
10648
+ break;
10649
+ }
10650
+ }
10651
+ return inheritedScopeIds;
10652
+ }
10426
10653
 
10427
10654
  const ssrContextKey = Symbol.for("v-scx");
10428
10655
  const useSSRContext = () => {
@@ -10771,8 +10998,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
10771
10998
  function defaultPropGetter(props, key) {
10772
10999
  return props[key];
10773
11000
  }
11001
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
10774
11002
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
10775
- const cache = appContext.emitsCache;
11003
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
10776
11004
  const cached = cache.get(comp);
10777
11005
  if (cached !== void 0) {
10778
11006
  return cached;
@@ -11244,7 +11472,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11244
11472
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
11245
11473
  if (pendingBranch) {
11246
11474
  suspense.pendingBranch = newBranch;
11247
- if (isSameVNodeType(newBranch, pendingBranch)) {
11475
+ if (isSameVNodeType(pendingBranch, newBranch)) {
11248
11476
  patch(
11249
11477
  pendingBranch,
11250
11478
  newBranch,
@@ -11315,7 +11543,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11315
11543
  );
11316
11544
  setActiveBranch(suspense, newFallback);
11317
11545
  }
11318
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11546
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11319
11547
  patch(
11320
11548
  activeBranch,
11321
11549
  newBranch,
@@ -11346,7 +11574,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11346
11574
  }
11347
11575
  }
11348
11576
  } else {
11349
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11577
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11350
11578
  patch(
11351
11579
  activeBranch,
11352
11580
  newBranch,
@@ -11459,7 +11687,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11459
11687
  pendingId,
11460
11688
  effects,
11461
11689
  parentComponent: parentComponent2,
11462
- container: container2
11690
+ container: container2,
11691
+ isInFallback
11463
11692
  } = suspense;
11464
11693
  let delayEnter = false;
11465
11694
  if (suspense.isHydrating) {
@@ -11477,6 +11706,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11477
11706
  parentComponent2
11478
11707
  );
11479
11708
  queuePostFlushCb(effects);
11709
+ if (isInFallback && vnode2.ssFallback) {
11710
+ vnode2.ssFallback.el = null;
11711
+ }
11480
11712
  }
11481
11713
  };
11482
11714
  }
@@ -11485,6 +11717,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11485
11717
  anchor = next(activeBranch);
11486
11718
  }
11487
11719
  unmount(activeBranch, parentComponent2, suspense, true);
11720
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11721
+ vnode2.ssFallback.el = null;
11722
+ }
11488
11723
  }
11489
11724
  if (!delayEnter) {
11490
11725
  move(
@@ -11609,6 +11844,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11609
11844
  optimized2
11610
11845
  );
11611
11846
  if (placeholder) {
11847
+ vnode2.placeholder = null;
11612
11848
  remove(placeholder);
11613
11849
  }
11614
11850
  updateHOCHostEl(instance, vnode2.el);
@@ -11871,15 +12107,11 @@ const createVNodeWithArgsTransform = (...args) => {
11871
12107
  );
11872
12108
  };
11873
12109
  const normalizeKey = ({ key }) => key != null ? key : null;
11874
- const normalizeRef = ({
11875
- ref,
11876
- ref_key,
11877
- ref_for
11878
- }) => {
12110
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
11879
12111
  if (typeof ref === "number") {
11880
12112
  ref = "" + ref;
11881
12113
  }
11882
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
12114
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
11883
12115
  };
11884
12116
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
11885
12117
  const vnode = {
@@ -12052,6 +12284,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
12052
12284
  suspense: vnode.suspense,
12053
12285
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
12054
12286
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
12287
+ placeholder: vnode.placeholder,
12055
12288
  el: vnode.el,
12056
12289
  anchor: vnode.anchor,
12057
12290
  ctx: vnode.ctx,
@@ -12593,7 +12826,7 @@ function getComponentPublicInstance(instance) {
12593
12826
  return instance.proxy;
12594
12827
  }
12595
12828
  }
12596
- const classifyRE = /(?:^|[-_])(\w)/g;
12829
+ const classifyRE = /(?:^|[-_])\w/g;
12597
12830
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
12598
12831
  function getComponentName(Component, includeInferred = true) {
12599
12832
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -12629,23 +12862,28 @@ const computed = (getterOrOptions, debugOptions) => {
12629
12862
  };
12630
12863
 
12631
12864
  function h(type, propsOrChildren, children) {
12632
- const l = arguments.length;
12633
- if (l === 2) {
12634
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12635
- if (isVNode(propsOrChildren)) {
12636
- return createVNode(type, null, [propsOrChildren]);
12865
+ try {
12866
+ setBlockTracking(-1);
12867
+ const l = arguments.length;
12868
+ if (l === 2) {
12869
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12870
+ if (isVNode(propsOrChildren)) {
12871
+ return createVNode(type, null, [propsOrChildren]);
12872
+ }
12873
+ return createVNode(type, propsOrChildren);
12874
+ } else {
12875
+ return createVNode(type, null, propsOrChildren);
12637
12876
  }
12638
- return createVNode(type, propsOrChildren);
12639
12877
  } else {
12640
- return createVNode(type, null, propsOrChildren);
12641
- }
12642
- } else {
12643
- if (l > 3) {
12644
- children = Array.prototype.slice.call(arguments, 2);
12645
- } else if (l === 3 && isVNode(children)) {
12646
- children = [children];
12878
+ if (l > 3) {
12879
+ children = Array.prototype.slice.call(arguments, 2);
12880
+ } else if (l === 3 && isVNode(children)) {
12881
+ children = [children];
12882
+ }
12883
+ return createVNode(type, propsOrChildren, children);
12647
12884
  }
12648
- return createVNode(type, propsOrChildren, children);
12885
+ } finally {
12886
+ setBlockTracking(1);
12649
12887
  }
12650
12888
  }
12651
12889
 
@@ -12855,7 +13093,7 @@ function isMemoSame(cached, memo) {
12855
13093
  return true;
12856
13094
  }
12857
13095
 
12858
- const version = "3.6.0-alpha.2";
13096
+ const version = "3.6.0-alpha.3";
12859
13097
  const warn = warn$1 ;
12860
13098
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12861
13099
  const devtools = devtools$1 ;
@@ -13125,11 +13363,11 @@ function resolveTransitionProps(rawProps) {
13125
13363
  addTransitionClass(el, legacyLeaveFromClass);
13126
13364
  }
13127
13365
  if (!el._enterCancelled) {
13128
- forceReflow();
13366
+ forceReflow(el);
13129
13367
  addTransitionClass(el, leaveActiveClass);
13130
13368
  } else {
13131
13369
  addTransitionClass(el, leaveActiveClass);
13132
- forceReflow();
13370
+ forceReflow(el);
13133
13371
  }
13134
13372
  nextFrame(() => {
13135
13373
  if (!el._isLeaving) {
@@ -13258,7 +13496,7 @@ function getTransitionInfo(el, expectedType) {
13258
13496
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
13259
13497
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
13260
13498
  }
13261
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
13499
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
13262
13500
  getStyleProperties(`${TRANSITION$1}Property`).toString()
13263
13501
  );
13264
13502
  return {
@@ -13278,8 +13516,9 @@ function toMs(s) {
13278
13516
  if (s === "auto") return 0;
13279
13517
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
13280
13518
  }
13281
- function forceReflow() {
13282
- return document.body.offsetHeight;
13519
+ function forceReflow(el) {
13520
+ const targetDocument = el ? el.ownerDocument : document;
13521
+ return targetDocument.body.offsetHeight;
13283
13522
  }
13284
13523
 
13285
13524
  function patchClass(el, value, isSVG) {
@@ -13299,6 +13538,8 @@ function patchClass(el, value, isSVG) {
13299
13538
  const vShowOriginalDisplay = Symbol("_vod");
13300
13539
  const vShowHidden = Symbol("_vsh");
13301
13540
  const vShow = {
13541
+ // used for prop mismatch check during hydration
13542
+ name: "show",
13302
13543
  beforeMount(el, { value }, { transition }) {
13303
13544
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
13304
13545
  if (transition && value) {
@@ -13332,9 +13573,6 @@ const vShow = {
13332
13573
  setDisplay(el, value);
13333
13574
  }
13334
13575
  };
13335
- {
13336
- vShow.name = "show";
13337
- }
13338
13576
  function setDisplay(el, value) {
13339
13577
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
13340
13578
  el[vShowHidden] = !value;
@@ -13352,7 +13590,7 @@ function useCssVars(getter) {
13352
13590
  return;
13353
13591
  }
13354
13592
 
13355
- const displayRE = /(^|;)\s*display\s*:/;
13593
+ const displayRE = /(?:^|;)\s*display\s*:/;
13356
13594
  function patchStyle(el, prev, next) {
13357
13595
  const style = el.style;
13358
13596
  const isCssString = isString(next);
@@ -13701,11 +13939,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
13701
13939
  }
13702
13940
 
13703
13941
  const REMOVAL = {};
13704
- /*! #__NO_SIDE_EFFECTS__ */
13705
13942
  // @__NO_SIDE_EFFECTS__
13706
13943
  function defineCustomElement(options, extraOptions, _createApp) {
13707
- const Comp = defineComponent(options, extraOptions);
13708
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
13944
+ let Comp = defineComponent(options, extraOptions);
13945
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
13709
13946
  class VueCustomElement extends VueElement {
13710
13947
  constructor(initialProps) {
13711
13948
  super(Comp, initialProps, _createApp);
@@ -13714,10 +13951,9 @@ function defineCustomElement(options, extraOptions, _createApp) {
13714
13951
  VueCustomElement.def = Comp;
13715
13952
  return VueCustomElement;
13716
13953
  }
13717
- /*! #__NO_SIDE_EFFECTS__ */
13718
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13954
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13719
13955
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13720
- };
13956
+ });
13721
13957
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13722
13958
  };
13723
13959
  class VueElement extends BaseClass {
@@ -13741,6 +13977,8 @@ class VueElement extends BaseClass {
13741
13977
  this._nonce = this._def.nonce;
13742
13978
  this._connected = false;
13743
13979
  this._resolved = false;
13980
+ this._patching = false;
13981
+ this._dirty = false;
13744
13982
  this._numberProps = null;
13745
13983
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13746
13984
  this._ob = null;
@@ -13753,7 +13991,11 @@ class VueElement extends BaseClass {
13753
13991
  );
13754
13992
  }
13755
13993
  if (_def.shadowRoot !== false) {
13756
- this.attachShadow({ mode: "open" });
13994
+ this.attachShadow(
13995
+ extend({}, _def.shadowRootOptions, {
13996
+ mode: "open"
13997
+ })
13998
+ );
13757
13999
  this._root = this.shadowRoot;
13758
14000
  } else {
13759
14001
  this._root = this;
@@ -13813,9 +14055,18 @@ class VueElement extends BaseClass {
13813
14055
  this._app && this._app.unmount();
13814
14056
  if (this._instance) this._instance.ce = void 0;
13815
14057
  this._app = this._instance = null;
14058
+ if (this._teleportTargets) {
14059
+ this._teleportTargets.clear();
14060
+ this._teleportTargets = void 0;
14061
+ }
13816
14062
  }
13817
14063
  });
13818
14064
  }
14065
+ _processMutations(mutations) {
14066
+ for (const m of mutations) {
14067
+ this._setAttr(m.attributeName);
14068
+ }
14069
+ }
13819
14070
  /**
13820
14071
  * resolve inner component definition (handle possible async component)
13821
14072
  */
@@ -13826,11 +14077,7 @@ class VueElement extends BaseClass {
13826
14077
  for (let i = 0; i < this.attributes.length; i++) {
13827
14078
  this._setAttr(this.attributes[i].name);
13828
14079
  }
13829
- this._ob = new MutationObserver((mutations) => {
13830
- for (const m of mutations) {
13831
- this._setAttr(m.attributeName);
13832
- }
13833
- });
14080
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13834
14081
  this._ob.observe(this, { attributes: true });
13835
14082
  const resolve = (def, isAsync = false) => {
13836
14083
  this._resolved = true;
@@ -13907,7 +14154,7 @@ class VueElement extends BaseClass {
13907
14154
  return this._getProp(key);
13908
14155
  },
13909
14156
  set(val) {
13910
- this._setProp(key, val, true, true);
14157
+ this._setProp(key, val, true, !this._patching);
13911
14158
  }
13912
14159
  });
13913
14160
  }
@@ -13933,6 +14180,7 @@ class VueElement extends BaseClass {
13933
14180
  */
13934
14181
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13935
14182
  if (val !== this._props[key]) {
14183
+ this._dirty = true;
13936
14184
  if (val === REMOVAL) {
13937
14185
  delete this._props[key];
13938
14186
  } else {
@@ -13946,7 +14194,10 @@ class VueElement extends BaseClass {
13946
14194
  }
13947
14195
  if (shouldReflect) {
13948
14196
  const ob = this._ob;
13949
- ob && ob.disconnect();
14197
+ if (ob) {
14198
+ this._processMutations(ob.takeRecords());
14199
+ ob.disconnect();
14200
+ }
13950
14201
  if (val === true) {
13951
14202
  this.setAttribute(hyphenate(key), "");
13952
14203
  } else if (typeof val === "string" || typeof val === "number") {
@@ -14050,7 +14301,7 @@ class VueElement extends BaseClass {
14050
14301
  * Only called when shadowRoot is false
14051
14302
  */
14052
14303
  _renderSlots() {
14053
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
14304
+ const outlets = this._getSlots();
14054
14305
  const scopeId = this._instance.type.__scopeId;
14055
14306
  for (let i = 0; i < outlets.length; i++) {
14056
14307
  const o = outlets[i];
@@ -14076,12 +14327,45 @@ class VueElement extends BaseClass {
14076
14327
  parent.removeChild(o);
14077
14328
  }
14078
14329
  }
14330
+ /**
14331
+ * @internal
14332
+ */
14333
+ _getSlots() {
14334
+ const roots = [this];
14335
+ if (this._teleportTargets) {
14336
+ roots.push(...this._teleportTargets);
14337
+ }
14338
+ const slots = /* @__PURE__ */ new Set();
14339
+ for (const root of roots) {
14340
+ const found = root.querySelectorAll("slot");
14341
+ for (let i = 0; i < found.length; i++) {
14342
+ slots.add(found[i]);
14343
+ }
14344
+ }
14345
+ return Array.from(slots);
14346
+ }
14079
14347
  /**
14080
14348
  * @internal
14081
14349
  */
14082
14350
  _injectChildStyle(comp) {
14083
14351
  this._applyStyles(comp.styles, comp);
14084
14352
  }
14353
+ /**
14354
+ * @internal
14355
+ */
14356
+ _beginPatch() {
14357
+ this._patching = true;
14358
+ this._dirty = false;
14359
+ }
14360
+ /**
14361
+ * @internal
14362
+ */
14363
+ _endPatch() {
14364
+ this._patching = false;
14365
+ if (this._dirty && this._instance) {
14366
+ this._update();
14367
+ }
14368
+ }
14085
14369
  /**
14086
14370
  * @internal
14087
14371
  */
@@ -14177,26 +14461,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14177
14461
  prevChildren = [];
14178
14462
  return;
14179
14463
  }
14180
- prevChildren.forEach(callPendingCbs);
14464
+ prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
14181
14465
  prevChildren.forEach(recordPosition);
14182
14466
  const movedChildren = prevChildren.filter(applyTranslation);
14183
- forceReflow();
14467
+ forceReflow(instance.vnode.el);
14184
14468
  movedChildren.forEach((c) => {
14185
- const el = c.el;
14186
- const style = el.style;
14187
- addTransitionClass(el, moveClass);
14188
- style.transform = style.webkitTransform = style.transitionDuration = "";
14189
- const cb = el[moveCbKey] = (e) => {
14190
- if (e && e.target !== el) {
14191
- return;
14192
- }
14193
- if (!e || /transform$/.test(e.propertyName)) {
14194
- el.removeEventListener("transitionend", cb);
14195
- el[moveCbKey] = null;
14196
- removeTransitionClass(el, moveClass);
14197
- }
14198
- };
14199
- el.addEventListener("transitionend", cb);
14469
+ const el = c.el;
14470
+ handleMovedChildren(el, moveClass);
14200
14471
  });
14201
14472
  prevChildren = [];
14202
14473
  });
@@ -14225,10 +14496,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14225
14496
  instance
14226
14497
  )
14227
14498
  );
14228
- positionMap.set(
14229
- child,
14230
- child.el.getBoundingClientRect()
14231
- );
14499
+ positionMap.set(child, {
14500
+ left: child.el.offsetLeft,
14501
+ top: child.el.offsetTop
14502
+ });
14232
14503
  }
14233
14504
  }
14234
14505
  }
@@ -14249,8 +14520,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14249
14520
  }
14250
14521
  });
14251
14522
  const TransitionGroup = TransitionGroupImpl;
14252
- function callPendingCbs(c) {
14253
- const el = c.el;
14523
+ function callPendingCbs(el) {
14254
14524
  if (el[moveCbKey]) {
14255
14525
  el[moveCbKey]();
14256
14526
  }
@@ -14259,19 +14529,30 @@ function callPendingCbs(c) {
14259
14529
  }
14260
14530
  }
14261
14531
  function recordPosition(c) {
14262
- newPositionMap.set(c, c.el.getBoundingClientRect());
14532
+ newPositionMap.set(c, {
14533
+ left: c.el.offsetLeft,
14534
+ top: c.el.offsetTop
14535
+ });
14263
14536
  }
14264
14537
  function applyTranslation(c) {
14265
- const oldPos = positionMap.get(c);
14266
- const newPos = newPositionMap.get(c);
14538
+ if (baseApplyTranslation(
14539
+ positionMap.get(c),
14540
+ newPositionMap.get(c),
14541
+ c.el
14542
+ )) {
14543
+ return c;
14544
+ }
14545
+ }
14546
+ function baseApplyTranslation(oldPos, newPos, el) {
14267
14547
  const dx = oldPos.left - newPos.left;
14268
14548
  const dy = oldPos.top - newPos.top;
14269
14549
  if (dx || dy) {
14270
- const s = c.el.style;
14550
+ const s = el.style;
14271
14551
  s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
14272
14552
  s.transitionDuration = "0s";
14273
- return c;
14553
+ return true;
14274
14554
  }
14555
+ return false;
14275
14556
  }
14276
14557
  function hasCSSTransform(el, root, moveClass) {
14277
14558
  const clone = el.cloneNode();
@@ -14289,6 +14570,22 @@ function hasCSSTransform(el, root, moveClass) {
14289
14570
  container.removeChild(clone);
14290
14571
  return hasTransform;
14291
14572
  }
14573
+ const handleMovedChildren = (el, moveClass) => {
14574
+ const style = el.style;
14575
+ addTransitionClass(el, moveClass);
14576
+ style.transform = style.webkitTransform = style.transitionDuration = "";
14577
+ const cb = el[moveCbKey] = (e) => {
14578
+ if (e && e.target !== el) {
14579
+ return;
14580
+ }
14581
+ if (!e || e.propertyName.endsWith("transform")) {
14582
+ el.removeEventListener("transitionend", cb);
14583
+ el[moveCbKey] = null;
14584
+ removeTransitionClass(el, moveClass);
14585
+ }
14586
+ };
14587
+ el.addEventListener("transitionend", cb);
14588
+ };
14292
14589
 
14293
14590
  const getModelAssigner = (vnode) => {
14294
14591
  const fn = vnode.props["onUpdate:modelValue"] || vnode.props["onModelCompat:input"];
@@ -14324,21 +14621,21 @@ const vModelText = {
14324
14621
  vModelTextUpdate(el, oldValue, value, trim, number, lazy);
14325
14622
  }
14326
14623
  };
14624
+ function castValue(value, trim, number) {
14625
+ if (trim) value = value.trim();
14626
+ if (number) value = looseToNumber(value);
14627
+ return value;
14628
+ }
14327
14629
  const vModelTextInit = (el, trim, number, lazy, set) => {
14328
14630
  addEventListener(el, lazy ? "change" : "input", (e) => {
14329
14631
  if (e.target.composing) return;
14330
- let domValue = el.value;
14331
- if (trim) {
14332
- domValue = domValue.trim();
14333
- }
14334
- if (number || el.type === "number") {
14335
- domValue = looseToNumber(domValue);
14336
- }
14337
- (0, el[assignKey])(domValue);
14632
+ (0, el[assignKey])(
14633
+ castValue(el.value, trim, number || el.type === "number")
14634
+ );
14338
14635
  });
14339
- if (trim) {
14636
+ if (trim || number) {
14340
14637
  addEventListener(el, "change", () => {
14341
- el.value = el.value.trim();
14638
+ el.value = castValue(el.value, trim, number || el.type === "number");
14342
14639
  });
14343
14640
  }
14344
14641
  if (!lazy) {
@@ -14621,13 +14918,13 @@ const modifierGuards = {
14621
14918
  const withModifiers = (fn, modifiers) => {
14622
14919
  const cache = fn._withMods || (fn._withMods = {});
14623
14920
  const cacheKey = modifiers.join(".");
14624
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14921
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14625
14922
  for (let i = 0; i < modifiers.length; i++) {
14626
14923
  const guard = modifierGuards[modifiers[i]];
14627
14924
  if (guard && guard(event, modifiers)) return;
14628
14925
  }
14629
14926
  return fn(event, ...args);
14630
- });
14927
+ }));
14631
14928
  };
14632
14929
  const keyNames = {
14633
14930
  esc: "escape",
@@ -14657,7 +14954,7 @@ const withKeys = (fn, modifiers) => {
14657
14954
  }
14658
14955
  const cache = fn._withKeys || (fn._withKeys = {});
14659
14956
  const cacheKey = modifiers.join(".");
14660
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14957
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14661
14958
  if (!("key" in event)) {
14662
14959
  return;
14663
14960
  }
@@ -14687,7 +14984,7 @@ const withKeys = (fn, modifiers) => {
14687
14984
  }
14688
14985
  }
14689
14986
  }
14690
- });
14987
+ }));
14691
14988
  };
14692
14989
 
14693
14990
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14701,13 +14998,13 @@ function ensureHydrationRenderer() {
14701
14998
  enabledHydration = true;
14702
14999
  return renderer;
14703
15000
  }
14704
- const render = (...args) => {
15001
+ const render = ((...args) => {
14705
15002
  ensureRenderer().render(...args);
14706
- };
14707
- const hydrate = (...args) => {
15003
+ });
15004
+ const hydrate = ((...args) => {
14708
15005
  ensureHydrationRenderer().hydrate(...args);
14709
- };
14710
- const createApp = (...args) => {
15006
+ });
15007
+ const createApp = ((...args) => {
14711
15008
  const app = ensureRenderer().createApp(...args);
14712
15009
  {
14713
15010
  injectNativeTagCheck(app);
@@ -14723,7 +15020,7 @@ const createApp = (...args) => {
14723
15020
  if (container.nodeType === 1) {
14724
15021
  for (let i = 0; i < container.attributes.length; i++) {
14725
15022
  const attr = container.attributes[i];
14726
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
15023
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
14727
15024
  compatUtils.warnDeprecation(
14728
15025
  "GLOBAL_MOUNT_CONTAINER",
14729
15026
  null
@@ -14744,8 +15041,8 @@ const createApp = (...args) => {
14744
15041
  return proxy;
14745
15042
  };
14746
15043
  return app;
14747
- };
14748
- const createSSRApp = (...args) => {
15044
+ });
15045
+ const createSSRApp = ((...args) => {
14749
15046
  const app = ensureHydrationRenderer().createApp(...args);
14750
15047
  {
14751
15048
  injectNativeTagCheck(app);
@@ -14759,7 +15056,7 @@ const createSSRApp = (...args) => {
14759
15056
  }
14760
15057
  };
14761
15058
  return app;
14762
- };
15059
+ });
14763
15060
  function resolveRootNamespace(container) {
14764
15061
  if (container instanceof SVGElement) {
14765
15062
  return "svg";
@@ -16330,16 +16627,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16330
16627
  (id) => markScopeIdentifier(node, id, knownIds)
16331
16628
  );
16332
16629
  }
16630
+ } else if (node.type === "SwitchStatement") {
16631
+ if (node.scopeIds) {
16632
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16633
+ } else {
16634
+ walkSwitchStatement(
16635
+ node,
16636
+ false,
16637
+ (id) => markScopeIdentifier(node, id, knownIds)
16638
+ );
16639
+ }
16333
16640
  } else if (node.type === "CatchClause" && node.param) {
16334
- for (const id of extractIdentifiers(node.param)) {
16335
- markScopeIdentifier(node, id, knownIds);
16641
+ if (node.scopeIds) {
16642
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16643
+ } else {
16644
+ for (const id of extractIdentifiers(node.param)) {
16645
+ markScopeIdentifier(node, id, knownIds);
16646
+ }
16336
16647
  }
16337
16648
  } else if (isForStatement(node)) {
16338
- walkForStatement(
16339
- node,
16340
- false,
16341
- (id) => markScopeIdentifier(node, id, knownIds)
16342
- );
16649
+ if (node.scopeIds) {
16650
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16651
+ } else {
16652
+ walkForStatement(
16653
+ node,
16654
+ false,
16655
+ (id) => markScopeIdentifier(node, id, knownIds)
16656
+ );
16657
+ }
16343
16658
  }
16344
16659
  },
16345
16660
  leave(node, parent) {
@@ -16362,14 +16677,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
16362
16677
  if (id.name === "arguments") {
16363
16678
  return false;
16364
16679
  }
16365
- if (isReferenced(id, parent)) {
16680
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
16366
16681
  return true;
16367
16682
  }
16368
16683
  switch (parent.type) {
16369
16684
  case "AssignmentExpression":
16370
16685
  case "AssignmentPattern":
16371
16686
  return true;
16372
- case "ObjectPattern":
16687
+ case "ObjectProperty":
16688
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
16373
16689
  case "ArrayPattern":
16374
16690
  return isInDestructureAssignment(parent, parentStack);
16375
16691
  }
@@ -16409,7 +16725,8 @@ function walkFunctionParams(node, onIdent) {
16409
16725
  }
16410
16726
  }
16411
16727
  function walkBlockDeclarations(block, onIdent) {
16412
- for (const stmt of block.body) {
16728
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
16729
+ for (const stmt of body) {
16413
16730
  if (stmt.type === "VariableDeclaration") {
16414
16731
  if (stmt.declare) continue;
16415
16732
  for (const decl of stmt.declarations) {
@@ -16422,6 +16739,8 @@ function walkBlockDeclarations(block, onIdent) {
16422
16739
  onIdent(stmt.id);
16423
16740
  } else if (isForStatement(stmt)) {
16424
16741
  walkForStatement(stmt, true, onIdent);
16742
+ } else if (stmt.type === "SwitchStatement") {
16743
+ walkSwitchStatement(stmt, true, onIdent);
16425
16744
  }
16426
16745
  }
16427
16746
  }
@@ -16438,6 +16757,20 @@ function walkForStatement(stmt, isVar, onIdent) {
16438
16757
  }
16439
16758
  }
16440
16759
  }
16760
+ function walkSwitchStatement(stmt, isVar, onIdent) {
16761
+ for (const cs of stmt.cases) {
16762
+ for (const stmt2 of cs.consequent) {
16763
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
16764
+ for (const decl of stmt2.declarations) {
16765
+ for (const id of extractIdentifiers(decl.id)) {
16766
+ onIdent(id);
16767
+ }
16768
+ }
16769
+ }
16770
+ }
16771
+ walkBlockDeclarations(cs, onIdent);
16772
+ }
16773
+ }
16441
16774
  function extractIdentifiers(param, nodes = []) {
16442
16775
  switch (param.type) {
16443
16776
  case "Identifier":
@@ -16538,7 +16871,7 @@ function isReferenced(node, parent, grandparent) {
16538
16871
  if (parent.key === node) {
16539
16872
  return !!parent.computed;
16540
16873
  }
16541
- return true;
16874
+ return !grandparent || grandparent.type !== "ObjectPattern";
16542
16875
  // no: class { NODE = value; }
16543
16876
  // yes: class { [NODE] = value; }
16544
16877
  // yes: class { key = NODE; }
@@ -16588,6 +16921,9 @@ function isReferenced(node, parent, grandparent) {
16588
16921
  // yes: export { NODE as foo };
16589
16922
  // no: export { NODE as foo } from "foo";
16590
16923
  case "ExportSpecifier":
16924
+ if (grandparent == null ? void 0 : grandparent.source) {
16925
+ return false;
16926
+ }
16591
16927
  return parent.local === node;
16592
16928
  // no: import NODE from "foo";
16593
16929
  // no: import * as NODE from "foo";
@@ -16668,8 +17004,9 @@ function isCoreComponent(tag) {
16668
17004
  return BASE_TRANSITION;
16669
17005
  }
16670
17006
  }
16671
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
17007
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
16672
17008
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
17009
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16673
17010
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
16674
17011
  const isMemberExpressionNode = (exp, context) => {
16675
17012
  try {
@@ -16766,6 +17103,9 @@ function hasDynamicKeyVBind(node) {
16766
17103
  function isText$1(node) {
16767
17104
  return node.type === 5 || node.type === 2;
16768
17105
  }
17106
+ function isVPre(p) {
17107
+ return p.type === 7 && p.name === "pre";
17108
+ }
16769
17109
  function isVSlot(p) {
16770
17110
  return p.type === 7 && p.name === "slot";
16771
17111
  }
@@ -17064,7 +17404,7 @@ const tokenizer = new Tokenizer(stack, {
17064
17404
  ondirarg(start, end) {
17065
17405
  if (start === end) return;
17066
17406
  const arg = getSlice(start, end);
17067
- if (inVPre) {
17407
+ if (inVPre && !isVPre(currentProp)) {
17068
17408
  currentProp.name += arg;
17069
17409
  setLocEnd(currentProp.nameLoc, end);
17070
17410
  } else {
@@ -17079,7 +17419,7 @@ const tokenizer = new Tokenizer(stack, {
17079
17419
  },
17080
17420
  ondirmodifier(start, end) {
17081
17421
  const mod = getSlice(start, end);
17082
- if (inVPre) {
17422
+ if (inVPre && !isVPre(currentProp)) {
17083
17423
  currentProp.name += "." + mod;
17084
17424
  setLocEnd(currentProp.nameLoc, end);
17085
17425
  } else if (currentProp.name === "slot") {
@@ -17726,6 +18066,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17726
18066
  } else if (child.type === 12) {
17727
18067
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
17728
18068
  if (constantType >= 2) {
18069
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
18070
+ child.codegenNode.arguments.push(
18071
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
18072
+ );
18073
+ }
17729
18074
  toCache.push(child);
17730
18075
  continue;
17731
18076
  }
@@ -17754,7 +18099,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17754
18099
  }
17755
18100
  }
17756
18101
  let cachedAsArray = false;
17757
- const slotCacheKeys = [];
17758
18102
  if (toCache.length === children.length && node.type === 1) {
17759
18103
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
17760
18104
  node.codegenNode.children = getCacheExpression(
@@ -17764,7 +18108,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17764
18108
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17765
18109
  const slot = getSlotNode(node.codegenNode, "default");
17766
18110
  if (slot) {
17767
- slotCacheKeys.push(context.cached.length);
17768
18111
  slot.returns = getCacheExpression(
17769
18112
  createArrayExpression(slot.returns)
17770
18113
  );
@@ -17774,7 +18117,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17774
18117
  const slotName = findDir(node, "slot", true);
17775
18118
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17776
18119
  if (slot) {
17777
- slotCacheKeys.push(context.cached.length);
17778
18120
  slot.returns = getCacheExpression(
17779
18121
  createArrayExpression(slot.returns)
17780
18122
  );
@@ -17784,23 +18126,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17784
18126
  }
17785
18127
  if (!cachedAsArray) {
17786
18128
  for (const child of toCache) {
17787
- slotCacheKeys.push(context.cached.length);
17788
18129
  child.codegenNode = context.cache(child.codegenNode);
17789
18130
  }
17790
18131
  }
17791
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17792
- node.codegenNode.children.properties.push(
17793
- createObjectProperty(
17794
- `__`,
17795
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17796
- )
17797
- );
17798
- }
17799
18132
  function getCacheExpression(value) {
17800
18133
  const exp = context.cache(value);
17801
- if (inFor && context.hmr) {
17802
- exp.needArraySpread = true;
17803
- }
18134
+ exp.needArraySpread = true;
17804
18135
  return exp;
17805
18136
  }
17806
18137
  function getSlotNode(node2, name) {
@@ -19255,14 +19586,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
19255
19586
  knownIds
19256
19587
  );
19257
19588
  const children = [];
19589
+ const isTSNode = TS_NODE_TYPES.includes(ast.type);
19258
19590
  ids.sort((a, b) => a.start - b.start);
19259
19591
  ids.forEach((id, i) => {
19260
19592
  const start = id.start - 1;
19261
19593
  const end = id.end - 1;
19262
19594
  const last = ids[i - 1];
19263
- const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
19264
- if (leadingText.length || id.prefix) {
19265
- children.push(leadingText + (id.prefix || ``));
19595
+ if (!(isTSNode && i === 0)) {
19596
+ const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
19597
+ if (leadingText.length || id.prefix) {
19598
+ children.push(leadingText + (id.prefix || ``));
19599
+ }
19266
19600
  }
19267
19601
  const source = rawExp.slice(start, end);
19268
19602
  children.push(
@@ -19277,7 +19611,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
19277
19611
  id.isConstant ? 3 : 0
19278
19612
  )
19279
19613
  );
19280
- if (i === ids.length - 1 && end < rawExp.length) {
19614
+ if (i === ids.length - 1 && end < rawExp.length && !isTSNode) {
19281
19615
  children.push(rawExp.slice(end));
19282
19616
  }
19283
19617
  });
@@ -19315,7 +19649,7 @@ function isConst(type) {
19315
19649
  }
19316
19650
 
19317
19651
  const transformIf = createStructuralDirectiveTransform(
19318
- /^(if|else|else-if)$/,
19652
+ /^(?:if|else|else-if)$/,
19319
19653
  (node, dir, context) => {
19320
19654
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
19321
19655
  const siblings = context.parent.children;
@@ -19384,7 +19718,7 @@ function processIf(node, dir, context, processCodegen) {
19384
19718
  continue;
19385
19719
  }
19386
19720
  if (sibling && sibling.type === 9) {
19387
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
19721
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
19388
19722
  context.onError(
19389
19723
  createCompilerError(30, node.loc)
19390
19724
  );
@@ -19533,90 +19867,6 @@ function getParentCondition(node) {
19533
19867
  }
19534
19868
  }
19535
19869
 
19536
- const transformBind = (dir, _node, context) => {
19537
- const { modifiers, loc } = dir;
19538
- const arg = dir.arg;
19539
- let { exp } = dir;
19540
- if (exp && exp.type === 4 && !exp.content.trim()) {
19541
- {
19542
- context.onError(
19543
- createCompilerError(34, loc)
19544
- );
19545
- return {
19546
- props: [
19547
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19548
- ]
19549
- };
19550
- }
19551
- }
19552
- if (!exp) {
19553
- if (arg.type !== 4 || !arg.isStatic) {
19554
- context.onError(
19555
- createCompilerError(
19556
- 52,
19557
- arg.loc
19558
- )
19559
- );
19560
- return {
19561
- props: [
19562
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19563
- ]
19564
- };
19565
- }
19566
- transformBindShorthand(dir, context);
19567
- exp = dir.exp;
19568
- }
19569
- if (arg.type !== 4) {
19570
- arg.children.unshift(`(`);
19571
- arg.children.push(`) || ""`);
19572
- } else if (!arg.isStatic) {
19573
- arg.content = `${arg.content} || ""`;
19574
- }
19575
- if (modifiers.some((mod) => mod.content === "camel")) {
19576
- if (arg.type === 4) {
19577
- if (arg.isStatic) {
19578
- arg.content = camelize(arg.content);
19579
- } else {
19580
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19581
- }
19582
- } else {
19583
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19584
- arg.children.push(`)`);
19585
- }
19586
- }
19587
- if (!context.inSSR) {
19588
- if (modifiers.some((mod) => mod.content === "prop")) {
19589
- injectPrefix(arg, ".");
19590
- }
19591
- if (modifiers.some((mod) => mod.content === "attr")) {
19592
- injectPrefix(arg, "^");
19593
- }
19594
- }
19595
- return {
19596
- props: [createObjectProperty(arg, exp)]
19597
- };
19598
- };
19599
- const transformBindShorthand = (dir, context) => {
19600
- const arg = dir.arg;
19601
- const propName = camelize(arg.content);
19602
- dir.exp = createSimpleExpression(propName, false, arg.loc);
19603
- {
19604
- dir.exp = processExpression(dir.exp, context);
19605
- }
19606
- };
19607
- const injectPrefix = (arg, prefix) => {
19608
- if (arg.type === 4) {
19609
- if (arg.isStatic) {
19610
- arg.content = prefix + arg.content;
19611
- } else {
19612
- arg.content = `\`${prefix}\${${arg.content}}\``;
19613
- }
19614
- } else {
19615
- arg.children.unshift(`'${prefix}' + (`);
19616
- arg.children.push(`)`);
19617
- }
19618
- };
19619
-
19620
19870
  const transformFor = createStructuralDirectiveTransform(
19621
19871
  "for",
19622
19872
  (node, dir, context) => {
@@ -19629,9 +19879,6 @@ const transformFor = createStructuralDirectiveTransform(
19629
19879
  const memo = findDir(node, "memo");
19630
19880
  const keyProp = findProp(node, `key`, false, true);
19631
19881
  const isDirKey = keyProp && keyProp.type === 7;
19632
- if (isDirKey && !keyProp.exp) {
19633
- transformBindShorthand(keyProp, context);
19634
- }
19635
19882
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
19636
19883
  if (memo && keyExp && isDirKey) {
19637
19884
  {
@@ -19912,7 +20159,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19912
20159
  const dynamicSlots = [];
19913
20160
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
19914
20161
  if (!context.ssr && context.prefixIdentifiers) {
19915
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
20162
+ hasDynamicSlots = node.props.some(
20163
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
20164
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
19916
20165
  }
19917
20166
  const onComponentSlot = findDir(node, "slot", true);
19918
20167
  if (onComponentSlot) {
@@ -19975,7 +20224,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19975
20224
  );
19976
20225
  } else if (vElse = findDir(
19977
20226
  slotElement,
19978
- /^else(-if)?$/,
20227
+ /^else(?:-if)?$/,
19979
20228
  true
19980
20229
  /* allowEmpty */
19981
20230
  )) {
@@ -19987,7 +20236,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19987
20236
  break;
19988
20237
  }
19989
20238
  }
19990
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
20239
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
19991
20240
  let conditional = dynamicSlots[dynamicSlots.length - 1];
19992
20241
  while (conditional.alternate.type === 19) {
19993
20242
  conditional = conditional.alternate;
@@ -20945,6 +21194,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
20945
21194
  return ret;
20946
21195
  };
20947
21196
 
21197
+ const transformBind = (dir, _node, context) => {
21198
+ const { modifiers, loc } = dir;
21199
+ const arg = dir.arg;
21200
+ let { exp } = dir;
21201
+ if (exp && exp.type === 4 && !exp.content.trim()) {
21202
+ {
21203
+ context.onError(
21204
+ createCompilerError(34, loc)
21205
+ );
21206
+ return {
21207
+ props: [
21208
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
21209
+ ]
21210
+ };
21211
+ }
21212
+ }
21213
+ if (arg.type !== 4) {
21214
+ arg.children.unshift(`(`);
21215
+ arg.children.push(`) || ""`);
21216
+ } else if (!arg.isStatic) {
21217
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
21218
+ }
21219
+ if (modifiers.some((mod) => mod.content === "camel")) {
21220
+ if (arg.type === 4) {
21221
+ if (arg.isStatic) {
21222
+ arg.content = camelize(arg.content);
21223
+ } else {
21224
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
21225
+ }
21226
+ } else {
21227
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
21228
+ arg.children.push(`)`);
21229
+ }
21230
+ }
21231
+ if (!context.inSSR) {
21232
+ if (modifiers.some((mod) => mod.content === "prop")) {
21233
+ injectPrefix(arg, ".");
21234
+ }
21235
+ if (modifiers.some((mod) => mod.content === "attr")) {
21236
+ injectPrefix(arg, "^");
21237
+ }
21238
+ }
21239
+ return {
21240
+ props: [createObjectProperty(arg, exp)]
21241
+ };
21242
+ };
21243
+ const injectPrefix = (arg, prefix) => {
21244
+ if (arg.type === 4) {
21245
+ if (arg.isStatic) {
21246
+ arg.content = prefix + arg.content;
21247
+ } else {
21248
+ arg.content = `\`${prefix}\${${arg.content}}\``;
21249
+ }
21250
+ } else {
21251
+ arg.children.unshift(`'${prefix}' + (`);
21252
+ arg.children.push(`)`);
21253
+ }
21254
+ };
21255
+
20948
21256
  const transformText = (node, context) => {
20949
21257
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
20950
21258
  return () => {
@@ -21278,7 +21586,7 @@ const seen = /* @__PURE__ */ new WeakSet();
21278
21586
  const transformMemo = (node, context) => {
21279
21587
  if (node.type === 1) {
21280
21588
  const dir = findDir(node, "memo");
21281
- if (!dir || seen.has(node)) {
21589
+ if (!dir || seen.has(node) || context.inSSR) {
21282
21590
  return;
21283
21591
  }
21284
21592
  seen.add(node);
@@ -21300,9 +21608,36 @@ const transformMemo = (node, context) => {
21300
21608
  }
21301
21609
  };
21302
21610
 
21611
+ const transformVBindShorthand = (node, context) => {
21612
+ if (node.type === 1) {
21613
+ for (const prop of node.props) {
21614
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
21615
+ false) && prop.arg) {
21616
+ const arg = prop.arg;
21617
+ if (arg.type !== 4 || !arg.isStatic) {
21618
+ context.onError(
21619
+ createCompilerError(
21620
+ 52,
21621
+ arg.loc
21622
+ )
21623
+ );
21624
+ prop.exp = createSimpleExpression("", true, arg.loc);
21625
+ } else {
21626
+ const propName = camelize(arg.content);
21627
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
21628
+ propName[0] === "-") {
21629
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
21630
+ }
21631
+ }
21632
+ }
21633
+ }
21634
+ }
21635
+ };
21636
+
21303
21637
  function getBaseTransformPreset(prefixIdentifiers) {
21304
21638
  return [
21305
21639
  [
21640
+ transformVBindShorthand,
21306
21641
  transformOnce,
21307
21642
  transformIf,
21308
21643
  transformMemo,
@@ -21742,46 +22077,46 @@ const transformTransition = (node, context) => {
21742
22077
  if (node.type === 1 && node.tagType === 1) {
21743
22078
  const component = context.isBuiltInComponent(node.tag);
21744
22079
  if (component === TRANSITION) {
21745
- return () => {
21746
- if (!node.children.length) {
21747
- return;
21748
- }
21749
- if (hasMultipleChildren(node)) {
21750
- context.onError(
21751
- createDOMCompilerError(
21752
- 62,
21753
- {
21754
- start: node.children[0].loc.start,
21755
- end: node.children[node.children.length - 1].loc.end,
21756
- source: ""
21757
- }
21758
- )
21759
- );
21760
- }
21761
- const child = node.children[0];
21762
- if (child.type === 1) {
21763
- for (const p of child.props) {
21764
- if (p.type === 7 && p.name === "show") {
21765
- node.props.push({
21766
- type: 6,
21767
- name: "persisted",
21768
- nameLoc: node.loc,
21769
- value: void 0,
21770
- loc: node.loc
21771
- });
21772
- }
21773
- }
21774
- }
21775
- };
22080
+ return postTransformTransition(node, context.onError);
21776
22081
  }
21777
22082
  }
21778
22083
  };
21779
- function hasMultipleChildren(node) {
22084
+ function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
22085
+ return () => {
22086
+ if (!node.children.length) {
22087
+ return;
22088
+ }
22089
+ if (hasMultipleChildren(node)) {
22090
+ onError(
22091
+ createDOMCompilerError(62, {
22092
+ start: node.children[0].loc.start,
22093
+ end: node.children[node.children.length - 1].loc.end,
22094
+ source: ""
22095
+ })
22096
+ );
22097
+ }
22098
+ const child = node.children[0];
22099
+ if (child.type === 1) {
22100
+ for (const p of child.props) {
22101
+ if (p.type === 7 && p.name === "show") {
22102
+ node.props.push({
22103
+ type: 6,
22104
+ name: "persisted",
22105
+ nameLoc: node.loc,
22106
+ value: void 0,
22107
+ loc: node.loc
22108
+ });
22109
+ }
22110
+ }
22111
+ }
22112
+ };
22113
+ }
22114
+ function defaultHasMultipleChildren(node) {
21780
22115
  const children = node.children = node.children.filter(
21781
22116
  (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
21782
22117
  );
21783
22118
  const child = children[0];
21784
- return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
22119
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
21785
22120
  }
21786
22121
 
21787
22122
  const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
@@ -21856,7 +22191,7 @@ const getCachedNode = (node) => {
21856
22191
  return node.codegenNode;
21857
22192
  }
21858
22193
  };
21859
- const dataAriaRE = /^(data|aria)-/;
22194
+ const dataAriaRE = /^(?:data|aria)-/;
21860
22195
  const isStringifiableAttr = (name, ns) => {
21861
22196
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
21862
22197
  };
@@ -21867,6 +22202,9 @@ function analyzeNode(node) {
21867
22202
  if (node.type === 1 && isNonStringifiable(node.tag)) {
21868
22203
  return false;
21869
22204
  }
22205
+ if (node.type === 1 && findDir(node, "once", true)) {
22206
+ return false;
22207
+ }
21870
22208
  if (node.type === 12) {
21871
22209
  return [1, 0];
21872
22210
  }