Subversion Repositories wpShopGermany4

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7824 daniel 1
var Vue = (function (exports) {
2
  'use strict';
3
 
4
  /**
5
   * Make a map and return a function for checking if a key
6
   * is in that map.
7
   * IMPORTANT: all calls of this function must be prefixed with
8
   * \/\*#\_\_PURE\_\_\*\/
9
   * So that rollup can tree-shake them if necessary.
10
   */
11
  function makeMap(str, expectsLowerCase) {
12
      const map = Object.create(null);
13
      const list = str.split(',');
14
      for (let i = 0; i < list.length; i++) {
15
          map[list[i]] = true;
16
      }
17
      return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
18
  }
19
 
20
  /**
21
   * dev only flag -> name mapping
22
   */
23
  const PatchFlagNames = {
24
      [1 /* TEXT */]: `TEXT`,
25
      [2 /* CLASS */]: `CLASS`,
26
      [4 /* STYLE */]: `STYLE`,
27
      [8 /* PROPS */]: `PROPS`,
28
      [16 /* FULL_PROPS */]: `FULL_PROPS`,
29
      [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
30
      [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
31
      [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
32
      [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
33
      [512 /* NEED_PATCH */]: `NEED_PATCH`,
34
      [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
35
      [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
36
      [-1 /* HOISTED */]: `HOISTED`,
37
      [-2 /* BAIL */]: `BAIL`
38
  };
39
 
40
  /**
41
   * Dev only
42
   */
43
  const slotFlagsText = {
44
      [1 /* STABLE */]: 'STABLE',
45
      [2 /* DYNAMIC */]: 'DYNAMIC',
46
      [3 /* FORWARDED */]: 'FORWARDED'
47
  };
48
 
49
  const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
50
      'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
51
      'Object,Boolean,String,RegExp,Map,Set,JSON,Intl';
52
  const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
53
 
54
  const range = 2;
55
  function generateCodeFrame(source, start = 0, end = source.length) {
56
      const lines = source.split(/\r?\n/);
57
      let count = 0;
58
      const res = [];
59
      for (let i = 0; i < lines.length; i++) {
60
          count += lines[i].length + 1;
61
          if (count >= start) {
62
              for (let j = i - range; j <= i + range || end > count; j++) {
63
                  if (j < 0 || j >= lines.length)
64
                      continue;
65
                  const line = j + 1;
66
                  res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}|  ${lines[j]}`);
67
                  const lineLength = lines[j].length;
68
                  if (j === i) {
69
                      // push underline
70
                      const pad = start - (count - lineLength) + 1;
71
                      const length = Math.max(1, end > count ? lineLength - pad : end - start);
72
                      res.push(`   |  ` + ' '.repeat(pad) + '^'.repeat(length));
73
                  }
74
                  else if (j > i) {
75
                      if (end > count) {
76
                          const length = Math.max(Math.min(end - count, lineLength), 1);
77
                          res.push(`   |  ` + '^'.repeat(length));
78
                      }
79
                      count += lineLength + 1;
80
                  }
81
              }
82
              break;
83
          }
84
      }
85
      return res.join('\n');
86
  }
87
 
88
  /**
89
   * On the client we only need to offer special cases for boolean attributes that
90
   * have different names from their corresponding dom properties:
91
   * - itemscope -> N/A
92
   * - allowfullscreen -> allowFullscreen
93
   * - formnovalidate -> formNoValidate
94
   * - ismap -> isMap
95
   * - nomodule -> noModule
96
   * - novalidate -> noValidate
97
   * - readonly -> readOnly
98
   */
99
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
100
  const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
101
 
102
  function normalizeStyle(value) {
103
      if (isArray(value)) {
104
          const res = {};
105
          for (let i = 0; i < value.length; i++) {
106
              const item = value[i];
107
              const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
108
              if (normalized) {
109
                  for (const key in normalized) {
110
                      res[key] = normalized[key];
111
                  }
112
              }
113
          }
114
          return res;
115
      }
116
      else if (isObject(value)) {
117
          return value;
118
      }
119
  }
120
  const listDelimiterRE = /;(?![^(]*\))/g;
121
  const propertyDelimiterRE = /:(.+)/;
122
  function parseStringStyle(cssText) {
123
      const ret = {};
124
      cssText.split(listDelimiterRE).forEach(item => {
125
          if (item) {
126
              const tmp = item.split(propertyDelimiterRE);
127
              tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
128
          }
129
      });
130
      return ret;
131
  }
132
  function normalizeClass(value) {
133
      let res = '';
134
      if (isString(value)) {
135
          res = value;
136
      }
137
      else if (isArray(value)) {
138
          for (let i = 0; i < value.length; i++) {
139
              res += normalizeClass(value[i]) + ' ';
140
          }
141
      }
142
      else if (isObject(value)) {
143
          for (const name in value) {
144
              if (value[name]) {
145
                  res += name + ' ';
146
              }
147
          }
148
      }
149
      return res.trim();
150
  }
151
 
152
  // These tag configs are shared between compiler-dom and runtime-dom, so they
153
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
154
  const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
155
      'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
156
      'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
157
      'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
158
      'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
159
      'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
160
      'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
161
      'option,output,progress,select,textarea,details,dialog,menu,' +
162
      'summary,template,blockquote,iframe,tfoot';
163
  // https://developer.mozilla.org/en-US/docs/Web/SVG/Element
164
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
165
      'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
166
      'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
167
      'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
168
      'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
169
      'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
170
      'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
171
      'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
172
      'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
173
      'text,textPath,title,tspan,unknown,use,view';
174
  const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
175
  const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
176
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
177
  const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
178
 
179
  function looseCompareArrays(a, b) {
180
      if (a.length !== b.length)
181
          return false;
182
      let equal = true;
183
      for (let i = 0; equal && i < a.length; i++) {
184
          equal = looseEqual(a[i], b[i]);
185
      }
186
      return equal;
187
  }
188
  function looseEqual(a, b) {
189
      if (a === b)
190
          return true;
191
      let aValidType = isDate(a);
192
      let bValidType = isDate(b);
193
      if (aValidType || bValidType) {
194
          return aValidType && bValidType ? a.getTime() === b.getTime() : false;
195
      }
196
      aValidType = isArray(a);
197
      bValidType = isArray(b);
198
      if (aValidType || bValidType) {
199
          return aValidType && bValidType ? looseCompareArrays(a, b) : false;
200
      }
201
      aValidType = isObject(a);
202
      bValidType = isObject(b);
203
      if (aValidType || bValidType) {
204
          /* istanbul ignore if: this if will probably never be called */
205
          if (!aValidType || !bValidType) {
206
              return false;
207
          }
208
          const aKeysCount = Object.keys(a).length;
209
          const bKeysCount = Object.keys(b).length;
210
          if (aKeysCount !== bKeysCount) {
211
              return false;
212
          }
213
          for (const key in a) {
214
              const aHasKey = a.hasOwnProperty(key);
215
              const bHasKey = b.hasOwnProperty(key);
216
              if ((aHasKey && !bHasKey) ||
217
                  (!aHasKey && bHasKey) ||
218
                  !looseEqual(a[key], b[key])) {
219
                  return false;
220
              }
221
          }
222
      }
223
      return String(a) === String(b);
224
  }
225
  function looseIndexOf(arr, val) {
226
      return arr.findIndex(item => looseEqual(item, val));
227
  }
228
 
229
  /**
230
   * For converting {{ interpolation }} values to displayed strings.
231
   * @private
232
   */
233
  const toDisplayString = (val) => {
234
      return val == null
235
          ? ''
236
          : isObject(val)
237
              ? JSON.stringify(val, replacer, 2)
238
              : String(val);
239
  };
240
  const replacer = (_key, val) => {
241
      if (isMap(val)) {
242
          return {
243
              [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
244
                  entries[`${key} =>`] = val;
245
                  return entries;
246
              }, {})
247
          };
248
      }
249
      else if (isSet(val)) {
250
          return {
251
              [`Set(${val.size})`]: [...val.values()]
252
          };
253
      }
254
      else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
255
          return String(val);
256
      }
257
      return val;
258
  };
259
 
260
  const EMPTY_OBJ =  Object.freeze({})
261
      ;
262
  const EMPTY_ARR =  Object.freeze([]) ;
263
  const NOOP = () => { };
264
  /**
265
   * Always return false.
266
   */
267
  const NO = () => false;
268
  const onRE = /^on[^a-z]/;
269
  const isOn = (key) => onRE.test(key);
270
  const isModelListener = (key) => key.startsWith('onUpdate:');
271
  const extend = Object.assign;
272
  const remove = (arr, el) => {
273
      const i = arr.indexOf(el);
274
      if (i > -1) {
275
          arr.splice(i, 1);
276
      }
277
  };
278
  const hasOwnProperty = Object.prototype.hasOwnProperty;
279
  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
280
  const isArray = Array.isArray;
281
  const isMap = (val) => toTypeString(val) === '[object Map]';
282
  const isSet = (val) => toTypeString(val) === '[object Set]';
283
  const isDate = (val) => val instanceof Date;
284
  const isFunction = (val) => typeof val === 'function';
285
  const isString = (val) => typeof val === 'string';
286
  const isSymbol = (val) => typeof val === 'symbol';
287
  const isObject = (val) => val !== null && typeof val === 'object';
288
  const isPromise = (val) => {
289
      return isObject(val) && isFunction(val.then) && isFunction(val.catch);
290
  };
291
  const objectToString = Object.prototype.toString;
292
  const toTypeString = (value) => objectToString.call(value);
293
  const toRawType = (value) => {
294
      // extract "RawType" from strings like "[object RawType]"
295
      return toTypeString(value).slice(8, -1);
296
  };
297
  const isPlainObject = (val) => toTypeString(val) === '[object Object]';
298
  const isIntegerKey = (key) => isString(key) &&
299
      key !== 'NaN' &&
300
      key[0] !== '-' &&
301
      '' + parseInt(key, 10) === key;
302
  const isReservedProp = /*#__PURE__*/ makeMap(
303
  // the leading comma is intentional so empty string "" is also included
304
  ',key,ref,' +
305
      'onVnodeBeforeMount,onVnodeMounted,' +
306
      'onVnodeBeforeUpdate,onVnodeUpdated,' +
307
      'onVnodeBeforeUnmount,onVnodeUnmounted');
308
  const cacheStringFunction = (fn) => {
309
      const cache = Object.create(null);
310
      return ((str) => {
311
          const hit = cache[str];
312
          return hit || (cache[str] = fn(str));
313
      });
314
  };
315
  const camelizeRE = /-(\w)/g;
316
  /**
317
   * @private
318
   */
319
  const camelize = cacheStringFunction((str) => {
320
      return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
321
  });
322
  const hyphenateRE = /\B([A-Z])/g;
323
  /**
324
   * @private
325
   */
326
  const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
327
  /**
328
   * @private
329
   */
330
  const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
331
  /**
332
   * @private
333
   */
334
  const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
335
  // compare whether a value has changed, accounting for NaN.
336
  const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
337
  const invokeArrayFns = (fns, arg) => {
338
      for (let i = 0; i < fns.length; i++) {
339
          fns[i](arg);
340
      }
341
  };
342
  const def = (obj, key, value) => {
343
      Object.defineProperty(obj, key, {
344
          configurable: true,
345
          enumerable: false,
346
          value
347
      });
348
  };
349
  const toNumber = (val) => {
350
      const n = parseFloat(val);
351
      return isNaN(n) ? val : n;
352
  };
353
  let _globalThis;
354
  const getGlobalThis = () => {
355
      return (_globalThis ||
356
          (_globalThis =
357
              typeof globalThis !== 'undefined'
358
                  ? globalThis
359
                  : typeof self !== 'undefined'
360
                      ? self
361
                      : typeof window !== 'undefined'
362
                          ? window
363
                          : typeof global !== 'undefined'
364
                              ? global
365
                              : {}));
366
  };
367
 
368
  const targetMap = new WeakMap();
369
  const effectStack = [];
370
  let activeEffect;
371
  const ITERATE_KEY = Symbol( 'iterate' );
372
  const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' );
373
  function isEffect(fn) {
374
      return fn && fn._isEffect === true;
375
  }
376
  function effect(fn, options = EMPTY_OBJ) {
377
      if (isEffect(fn)) {
378
          fn = fn.raw;
379
      }
380
      const effect = createReactiveEffect(fn, options);
381
      if (!options.lazy) {
382
          effect();
383
      }
384
      return effect;
385
  }
386
  function stop(effect) {
387
      if (effect.active) {
388
          cleanup(effect);
389
          if (effect.options.onStop) {
390
              effect.options.onStop();
391
          }
392
          effect.active = false;
393
      }
394
  }
395
  let uid = 0;
396
  function createReactiveEffect(fn, options) {
397
      const effect = function reactiveEffect() {
398
          if (!effect.active) {
399
              return options.scheduler ? undefined : fn();
400
          }
401
          if (!effectStack.includes(effect)) {
402
              cleanup(effect);
403
              try {
404
                  enableTracking();
405
                  effectStack.push(effect);
406
                  activeEffect = effect;
407
                  return fn();
408
              }
409
              finally {
410
                  effectStack.pop();
411
                  resetTracking();
412
                  activeEffect = effectStack[effectStack.length - 1];
413
              }
414
          }
415
      };
416
      effect.id = uid++;
417
      effect.allowRecurse = !!options.allowRecurse;
418
      effect._isEffect = true;
419
      effect.active = true;
420
      effect.raw = fn;
421
      effect.deps = [];
422
      effect.options = options;
423
      return effect;
424
  }
425
  function cleanup(effect) {
426
      const { deps } = effect;
427
      if (deps.length) {
428
          for (let i = 0; i < deps.length; i++) {
429
              deps[i].delete(effect);
430
          }
431
          deps.length = 0;
432
      }
433
  }
434
  let shouldTrack = true;
435
  const trackStack = [];
436
  function pauseTracking() {
437
      trackStack.push(shouldTrack);
438
      shouldTrack = false;
439
  }
440
  function enableTracking() {
441
      trackStack.push(shouldTrack);
442
      shouldTrack = true;
443
  }
444
  function resetTracking() {
445
      const last = trackStack.pop();
446
      shouldTrack = last === undefined ? true : last;
447
  }
448
  function track(target, type, key) {
449
      if (!shouldTrack || activeEffect === undefined) {
450
          return;
451
      }
452
      let depsMap = targetMap.get(target);
453
      if (!depsMap) {
454
          targetMap.set(target, (depsMap = new Map()));
455
      }
456
      let dep = depsMap.get(key);
457
      if (!dep) {
458
          depsMap.set(key, (dep = new Set()));
459
      }
460
      if (!dep.has(activeEffect)) {
461
          dep.add(activeEffect);
462
          activeEffect.deps.push(dep);
463
          if ( activeEffect.options.onTrack) {
464
              activeEffect.options.onTrack({
465
                  effect: activeEffect,
466
                  target,
467
                  type,
468
                  key
469
              });
470
          }
471
      }
472
  }
473
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
474
      const depsMap = targetMap.get(target);
475
      if (!depsMap) {
476
          // never been tracked
477
          return;
478
      }
479
      const effects = new Set();
480
      const add = (effectsToAdd) => {
481
          if (effectsToAdd) {
482
              effectsToAdd.forEach(effect => {
483
                  if (effect !== activeEffect || effect.allowRecurse) {
484
                      effects.add(effect);
485
                  }
486
              });
487
          }
488
      };
489
      if (type === "clear" /* CLEAR */) {
490
          // collection being cleared
491
          // trigger all effects for target
492
          depsMap.forEach(add);
493
      }
494
      else if (key === 'length' && isArray(target)) {
495
          depsMap.forEach((dep, key) => {
496
              if (key === 'length' || key >= newValue) {
497
                  add(dep);
498
              }
499
          });
500
      }
501
      else {
502
          // schedule runs for SET | ADD | DELETE
503
          if (key !== void 0) {
504
              add(depsMap.get(key));
505
          }
506
          // also run for iteration key on ADD | DELETE | Map.SET
507
          switch (type) {
508
              case "add" /* ADD */:
509
                  if (!isArray(target)) {
510
                      add(depsMap.get(ITERATE_KEY));
511
                      if (isMap(target)) {
512
                          add(depsMap.get(MAP_KEY_ITERATE_KEY));
513
                      }
514
                  }
515
                  else if (isIntegerKey(key)) {
516
                      // new index added to array -> length changes
517
                      add(depsMap.get('length'));
518
                  }
519
                  break;
520
              case "delete" /* DELETE */:
521
                  if (!isArray(target)) {
522
                      add(depsMap.get(ITERATE_KEY));
523
                      if (isMap(target)) {
524
                          add(depsMap.get(MAP_KEY_ITERATE_KEY));
525
                      }
526
                  }
527
                  break;
528
              case "set" /* SET */:
529
                  if (isMap(target)) {
530
                      add(depsMap.get(ITERATE_KEY));
531
                  }
532
                  break;
533
          }
534
      }
535
      const run = (effect) => {
536
          if ( effect.options.onTrigger) {
537
              effect.options.onTrigger({
538
                  effect,
539
                  target,
540
                  key,
541
                  type,
542
                  newValue,
543
                  oldValue,
544
                  oldTarget
545
              });
546
          }
547
          if (effect.options.scheduler) {
548
              effect.options.scheduler(effect);
549
          }
550
          else {
551
              effect();
552
          }
553
      };
554
      effects.forEach(run);
555
  }
556
 
557
  const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
558
      .map(key => Symbol[key])
559
      .filter(isSymbol));
560
  const get = /*#__PURE__*/ createGetter();
561
  const shallowGet = /*#__PURE__*/ createGetter(false, true);
562
  const readonlyGet = /*#__PURE__*/ createGetter(true);
563
  const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
564
  const arrayInstrumentations = {};
565
  ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
566
      const method = Array.prototype[key];
567
      arrayInstrumentations[key] = function (...args) {
568
          const arr = toRaw(this);
569
          for (let i = 0, l = this.length; i < l; i++) {
570
              track(arr, "get" /* GET */, i + '');
571
          }
572
          // we run the method using the original args first (which may be reactive)
573
          const res = method.apply(arr, args);
574
          if (res === -1 || res === false) {
575
              // if that didn't work, run it again using raw values.
576
              return method.apply(arr, args.map(toRaw));
577
          }
578
          else {
579
              return res;
580
          }
581
      };
582
  });
583
  ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
584
      const method = Array.prototype[key];
585
      arrayInstrumentations[key] = function (...args) {
586
          pauseTracking();
587
          const res = method.apply(this, args);
588
          resetTracking();
589
          return res;
590
      };
591
  });
592
  function createGetter(isReadonly = false, shallow = false) {
593
      return function get(target, key, receiver) {
594
          if (key === "__v_isReactive" /* IS_REACTIVE */) {
595
              return !isReadonly;
596
          }
597
          else if (key === "__v_isReadonly" /* IS_READONLY */) {
598
              return isReadonly;
599
          }
600
          else if (key === "__v_raw" /* RAW */ &&
601
              receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
602
              return target;
603
          }
604
          const targetIsArray = isArray(target);
605
          if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
606
              return Reflect.get(arrayInstrumentations, key, receiver);
607
          }
608
          const res = Reflect.get(target, key, receiver);
609
          if (isSymbol(key)
610
              ? builtInSymbols.has(key)
611
              : key === `__proto__` || key === `__v_isRef`) {
612
              return res;
613
          }
614
          if (!isReadonly) {
615
              track(target, "get" /* GET */, key);
616
          }
617
          if (shallow) {
618
              return res;
619
          }
620
          if (isRef(res)) {
621
              // ref unwrapping - does not apply for Array + integer key.
622
              const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
623
              return shouldUnwrap ? res.value : res;
624
          }
625
          if (isObject(res)) {
626
              // Convert returned value into a proxy as well. we do the isObject check
627
              // here to avoid invalid value warning. Also need to lazy access readonly
628
              // and reactive here to avoid circular dependency.
629
              return isReadonly ? readonly(res) : reactive(res);
630
          }
631
          return res;
632
      };
633
  }
634
  const set = /*#__PURE__*/ createSetter();
635
  const shallowSet = /*#__PURE__*/ createSetter(true);
636
  function createSetter(shallow = false) {
637
      return function set(target, key, value, receiver) {
638
          const oldValue = target[key];
639
          if (!shallow) {
640
              value = toRaw(value);
641
              if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
642
                  oldValue.value = value;
643
                  return true;
644
              }
645
          }
646
          const hadKey = isArray(target) && isIntegerKey(key)
647
              ? Number(key) < target.length
648
              : hasOwn(target, key);
649
          const result = Reflect.set(target, key, value, receiver);
650
          // don't trigger if target is something up in the prototype chain of original
651
          if (target === toRaw(receiver)) {
652
              if (!hadKey) {
653
                  trigger(target, "add" /* ADD */, key, value);
654
              }
655
              else if (hasChanged(value, oldValue)) {
656
                  trigger(target, "set" /* SET */, key, value, oldValue);
657
              }
658
          }
659
          return result;
660
      };
661
  }
662
  function deleteProperty(target, key) {
663
      const hadKey = hasOwn(target, key);
664
      const oldValue = target[key];
665
      const result = Reflect.deleteProperty(target, key);
666
      if (result && hadKey) {
667
          trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
668
      }
669
      return result;
670
  }
671
  function has(target, key) {
672
      const result = Reflect.has(target, key);
673
      if (!isSymbol(key) || !builtInSymbols.has(key)) {
674
          track(target, "has" /* HAS */, key);
675
      }
676
      return result;
677
  }
678
  function ownKeys(target) {
679
      track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
680
      return Reflect.ownKeys(target);
681
  }
682
  const mutableHandlers = {
683
      get,
684
      set,
685
      deleteProperty,
686
      has,
687
      ownKeys
688
  };
689
  const readonlyHandlers = {
690
      get: readonlyGet,
691
      set(target, key) {
692
          {
693
              console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
694
          }
695
          return true;
696
      },
697
      deleteProperty(target, key) {
698
          {
699
              console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
700
          }
701
          return true;
702
      }
703
  };
704
  const shallowReactiveHandlers = extend({}, mutableHandlers, {
705
      get: shallowGet,
706
      set: shallowSet
707
  });
708
  // Props handlers are special in the sense that it should not unwrap top-level
709
  // refs (in order to allow refs to be explicitly passed down), but should
710
  // retain the reactivity of the normal readonly object.
711
  const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
712
      get: shallowReadonlyGet
713
  });
714
 
715
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
716
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
717
  const toShallow = (value) => value;
718
  const getProto = (v) => Reflect.getPrototypeOf(v);
719
  function get$1(target, key, isReadonly = false, isShallow = false) {
720
      // #1772: readonly(reactive(Map)) should return readonly + reactive version
721
      // of the value
722
      target = target["__v_raw" /* RAW */];
723
      const rawTarget = toRaw(target);
724
      const rawKey = toRaw(key);
725
      if (key !== rawKey) {
726
          !isReadonly && track(rawTarget, "get" /* GET */, key);
727
      }
728
      !isReadonly && track(rawTarget, "get" /* GET */, rawKey);
729
      const { has } = getProto(rawTarget);
730
      const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
731
      if (has.call(rawTarget, key)) {
732
          return wrap(target.get(key));
733
      }
734
      else if (has.call(rawTarget, rawKey)) {
735
          return wrap(target.get(rawKey));
736
      }
737
  }
738
  function has$1(key, isReadonly = false) {
739
      const target = this["__v_raw" /* RAW */];
740
      const rawTarget = toRaw(target);
741
      const rawKey = toRaw(key);
742
      if (key !== rawKey) {
743
          !isReadonly && track(rawTarget, "has" /* HAS */, key);
744
      }
745
      !isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
746
      return key === rawKey
747
          ? target.has(key)
748
          : target.has(key) || target.has(rawKey);
749
  }
750
  function size(target, isReadonly = false) {
751
      target = target["__v_raw" /* RAW */];
752
      !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
753
      return Reflect.get(target, 'size', target);
754
  }
755
  function add(value) {
756
      value = toRaw(value);
757
      const target = toRaw(this);
758
      const proto = getProto(target);
759
      const hadKey = proto.has.call(target, value);
760
      target.add(value);
761
      if (!hadKey) {
762
          trigger(target, "add" /* ADD */, value, value);
763
      }
764
      return this;
765
  }
766
  function set$1(key, value) {
767
      value = toRaw(value);
768
      const target = toRaw(this);
769
      const { has, get } = getProto(target);
770
      let hadKey = has.call(target, key);
771
      if (!hadKey) {
772
          key = toRaw(key);
773
          hadKey = has.call(target, key);
774
      }
775
      else {
776
          checkIdentityKeys(target, has, key);
777
      }
778
      const oldValue = get.call(target, key);
779
      target.set(key, value);
780
      if (!hadKey) {
781
          trigger(target, "add" /* ADD */, key, value);
782
      }
783
      else if (hasChanged(value, oldValue)) {
784
          trigger(target, "set" /* SET */, key, value, oldValue);
785
      }
786
      return this;
787
  }
788
  function deleteEntry(key) {
789
      const target = toRaw(this);
790
      const { has, get } = getProto(target);
791
      let hadKey = has.call(target, key);
792
      if (!hadKey) {
793
          key = toRaw(key);
794
          hadKey = has.call(target, key);
795
      }
796
      else {
797
          checkIdentityKeys(target, has, key);
798
      }
799
      const oldValue = get ? get.call(target, key) : undefined;
800
      // forward the operation before queueing reactions
801
      const result = target.delete(key);
802
      if (hadKey) {
803
          trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
804
      }
805
      return result;
806
  }
807
  function clear() {
808
      const target = toRaw(this);
809
      const hadItems = target.size !== 0;
810
      const oldTarget =  isMap(target)
811
              ? new Map(target)
812
              : new Set(target)
813
          ;
814
      // forward the operation before queueing reactions
815
      const result = target.clear();
816
      if (hadItems) {
817
          trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
818
      }
819
      return result;
820
  }
821
  function createForEach(isReadonly, isShallow) {
822
      return function forEach(callback, thisArg) {
823
          const observed = this;
824
          const target = observed["__v_raw" /* RAW */];
825
          const rawTarget = toRaw(target);
826
          const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
827
          !isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
828
          return target.forEach((value, key) => {
829
              // important: make sure the callback is
830
              // 1. invoked with the reactive map as `this` and 3rd arg
831
              // 2. the value received should be a corresponding reactive/readonly.
832
              return callback.call(thisArg, wrap(value), wrap(key), observed);
833
          });
834
      };
835
  }
836
  function createIterableMethod(method, isReadonly, isShallow) {
837
      return function (...args) {
838
          const target = this["__v_raw" /* RAW */];
839
          const rawTarget = toRaw(target);
840
          const targetIsMap = isMap(rawTarget);
841
          const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
842
          const isKeyOnly = method === 'keys' && targetIsMap;
843
          const innerIterator = target[method](...args);
844
          const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
845
          !isReadonly &&
846
              track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
847
          // return a wrapped iterator which returns observed versions of the
848
          // values emitted from the real iterator
849
          return {
850
              // iterator protocol
851
              next() {
852
                  const { value, done } = innerIterator.next();
853
                  return done
854
                      ? { value, done }
855
                      : {
856
                          value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
857
                          done
858
                      };
859
              },
860
              // iterable protocol
861
              [Symbol.iterator]() {
862
                  return this;
863
              }
864
          };
865
      };
866
  }
867
  function createReadonlyMethod(type) {
868
      return function (...args) {
869
          {
870
              const key = args[0] ? `on key "${args[0]}" ` : ``;
871
              console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
872
          }
873
          return type === "delete" /* DELETE */ ? false : this;
874
      };
875
  }
876
  const mutableInstrumentations = {
877
      get(key) {
878
          return get$1(this, key);
879
      },
880
      get size() {
881
          return size(this);
882
      },
883
      has: has$1,
884
      add,
885
      set: set$1,
886
      delete: deleteEntry,
887
      clear,
888
      forEach: createForEach(false, false)
889
  };
890
  const shallowInstrumentations = {
891
      get(key) {
892
          return get$1(this, key, false, true);
893
      },
894
      get size() {
895
          return size(this);
896
      },
897
      has: has$1,
898
      add,
899
      set: set$1,
900
      delete: deleteEntry,
901
      clear,
902
      forEach: createForEach(false, true)
903
  };
904
  const readonlyInstrumentations = {
905
      get(key) {
906
          return get$1(this, key, true);
907
      },
908
      get size() {
909
          return size(this, true);
910
      },
911
      has(key) {
912
          return has$1.call(this, key, true);
913
      },
914
      add: createReadonlyMethod("add" /* ADD */),
915
      set: createReadonlyMethod("set" /* SET */),
916
      delete: createReadonlyMethod("delete" /* DELETE */),
917
      clear: createReadonlyMethod("clear" /* CLEAR */),
918
      forEach: createForEach(true, false)
919
  };
920
  const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
921
  iteratorMethods.forEach(method => {
922
      mutableInstrumentations[method] = createIterableMethod(method, false, false);
923
      readonlyInstrumentations[method] = createIterableMethod(method, true, false);
924
      shallowInstrumentations[method] = createIterableMethod(method, false, true);
925
  });
926
  function createInstrumentationGetter(isReadonly, shallow) {
927
      const instrumentations = shallow
928
          ? shallowInstrumentations
929
          : isReadonly
930
              ? readonlyInstrumentations
931
              : mutableInstrumentations;
932
      return (target, key, receiver) => {
933
          if (key === "__v_isReactive" /* IS_REACTIVE */) {
934
              return !isReadonly;
935
          }
936
          else if (key === "__v_isReadonly" /* IS_READONLY */) {
937
              return isReadonly;
938
          }
939
          else if (key === "__v_raw" /* RAW */) {
940
              return target;
941
          }
942
          return Reflect.get(hasOwn(instrumentations, key) && key in target
943
              ? instrumentations
944
              : target, key, receiver);
945
      };
946
  }
947
  const mutableCollectionHandlers = {
948
      get: createInstrumentationGetter(false, false)
949
  };
950
  const shallowCollectionHandlers = {
951
      get: createInstrumentationGetter(false, true)
952
  };
953
  const readonlyCollectionHandlers = {
954
      get: createInstrumentationGetter(true, false)
955
  };
956
  function checkIdentityKeys(target, has, key) {
957
      const rawKey = toRaw(key);
958
      if (rawKey !== key && has.call(target, rawKey)) {
959
          const type = toRawType(target);
960
          console.warn(`Reactive ${type} contains both the raw and reactive ` +
961
              `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
962
              `which can lead to inconsistencies. ` +
963
              `Avoid differentiating between the raw and reactive versions ` +
964
              `of an object and only use the reactive version if possible.`);
965
      }
966
  }
967
 
968
  const reactiveMap = new WeakMap();
969
  const readonlyMap = new WeakMap();
970
  function targetTypeMap(rawType) {
971
      switch (rawType) {
972
          case 'Object':
973
          case 'Array':
974
              return 1 /* COMMON */;
975
          case 'Map':
976
          case 'Set':
977
          case 'WeakMap':
978
          case 'WeakSet':
979
              return 2 /* COLLECTION */;
980
          default:
981
              return 0 /* INVALID */;
982
      }
983
  }
984
  function getTargetType(value) {
985
      return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
986
          ? 0 /* INVALID */
987
          : targetTypeMap(toRawType(value));
988
  }
989
  function reactive(target) {
990
      // if trying to observe a readonly proxy, return the readonly version.
991
      if (target && target["__v_isReadonly" /* IS_READONLY */]) {
992
          return target;
993
      }
994
      return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
995
  }
996
  /**
997
   * Return a shallowly-reactive copy of the original object, where only the root
998
   * level properties are reactive. It also does not auto-unwrap refs (even at the
999
   * root level).
1000
   */
1001
  function shallowReactive(target) {
1002
      return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
1003
  }
1004
  /**
1005
   * Creates a readonly copy of the original object. Note the returned copy is not
1006
   * made reactive, but `readonly` can be called on an already reactive object.
1007
   */
1008
  function readonly(target) {
1009
      return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
1010
  }
1011
  /**
1012
   * Returns a reactive-copy of the original object, where only the root level
1013
   * properties are readonly, and does NOT unwrap refs nor recursively convert
1014
   * returned properties.
1015
   * This is used for creating the props proxy object for stateful components.
1016
   */
1017
  function shallowReadonly(target) {
1018
      return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
1019
  }
1020
  function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
1021
      if (!isObject(target)) {
1022
          {
1023
              console.warn(`value cannot be made reactive: ${String(target)}`);
1024
          }
1025
          return target;
1026
      }
1027
      // target is already a Proxy, return it.
1028
      // exception: calling readonly() on a reactive object
1029
      if (target["__v_raw" /* RAW */] &&
1030
          !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
1031
          return target;
1032
      }
1033
      // target already has corresponding Proxy
1034
      const proxyMap = isReadonly ? readonlyMap : reactiveMap;
1035
      const existingProxy = proxyMap.get(target);
1036
      if (existingProxy) {
1037
          return existingProxy;
1038
      }
1039
      // only a whitelist of value types can be observed.
1040
      const targetType = getTargetType(target);
1041
      if (targetType === 0 /* INVALID */) {
1042
          return target;
1043
      }
1044
      const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
1045
      proxyMap.set(target, proxy);
1046
      return proxy;
1047
  }
1048
  function isReactive(value) {
1049
      if (isReadonly(value)) {
1050
          return isReactive(value["__v_raw" /* RAW */]);
1051
      }
1052
      return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
1053
  }
1054
  function isReadonly(value) {
1055
      return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1056
  }
1057
  function isProxy(value) {
1058
      return isReactive(value) || isReadonly(value);
1059
  }
1060
  function toRaw(observed) {
1061
      return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
1062
  }
1063
  function markRaw(value) {
1064
      def(value, "__v_skip" /* SKIP */, true);
1065
      return value;
1066
  }
1067
 
1068
  const convert = (val) => isObject(val) ? reactive(val) : val;
1069
  function isRef(r) {
1070
      return Boolean(r && r.__v_isRef === true);
1071
  }
1072
  function ref(value) {
1073
      return createRef(value);
1074
  }
1075
  function shallowRef(value) {
1076
      return createRef(value, true);
1077
  }
1078
  class RefImpl {
1079
      constructor(_rawValue, _shallow = false) {
1080
          this._rawValue = _rawValue;
1081
          this._shallow = _shallow;
1082
          this.__v_isRef = true;
1083
          this._value = _shallow ? _rawValue : convert(_rawValue);
1084
      }
1085
      get value() {
1086
          track(toRaw(this), "get" /* GET */, 'value');
1087
          return this._value;
1088
      }
1089
      set value(newVal) {
1090
          if (hasChanged(toRaw(newVal), this._rawValue)) {
1091
              this._rawValue = newVal;
1092
              this._value = this._shallow ? newVal : convert(newVal);
1093
              trigger(toRaw(this), "set" /* SET */, 'value', newVal);
1094
          }
1095
      }
1096
  }
1097
  function createRef(rawValue, shallow = false) {
1098
      if (isRef(rawValue)) {
1099
          return rawValue;
1100
      }
1101
      return new RefImpl(rawValue, shallow);
1102
  }
1103
  function triggerRef(ref) {
1104
      trigger(toRaw(ref), "set" /* SET */, 'value',  ref.value );
1105
  }
1106
  function unref(ref) {
1107
      return isRef(ref) ? ref.value : ref;
1108
  }
1109
  const shallowUnwrapHandlers = {
1110
      get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1111
      set: (target, key, value, receiver) => {
1112
          const oldValue = target[key];
1113
          if (isRef(oldValue) && !isRef(value)) {
1114
              oldValue.value = value;
1115
              return true;
1116
          }
1117
          else {
1118
              return Reflect.set(target, key, value, receiver);
1119
          }
1120
      }
1121
  };
1122
  function proxyRefs(objectWithRefs) {
1123
      return isReactive(objectWithRefs)
1124
          ? objectWithRefs
1125
          : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1126
  }
1127
  class CustomRefImpl {
1128
      constructor(factory) {
1129
          this.__v_isRef = true;
1130
          const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
1131
          this._get = get;
1132
          this._set = set;
1133
      }
1134
      get value() {
1135
          return this._get();
1136
      }
1137
      set value(newVal) {
1138
          this._set(newVal);
1139
      }
1140
  }
1141
  function customRef(factory) {
1142
      return new CustomRefImpl(factory);
1143
  }
1144
  function toRefs(object) {
1145
      if ( !isProxy(object)) {
1146
          console.warn(`toRefs() expects a reactive object but received a plain one.`);
1147
      }
1148
      const ret = isArray(object) ? new Array(object.length) : {};
1149
      for (const key in object) {
1150
          ret[key] = toRef(object, key);
1151
      }
1152
      return ret;
1153
  }
1154
  class ObjectRefImpl {
1155
      constructor(_object, _key) {
1156
          this._object = _object;
1157
          this._key = _key;
1158
          this.__v_isRef = true;
1159
      }
1160
      get value() {
1161
          return this._object[this._key];
1162
      }
1163
      set value(newVal) {
1164
          this._object[this._key] = newVal;
1165
      }
1166
  }
1167
  function toRef(object, key) {
1168
      return isRef(object[key])
1169
          ? object[key]
1170
          : new ObjectRefImpl(object, key);
1171
  }
1172
 
1173
  class ComputedRefImpl {
1174
      constructor(getter, _setter, isReadonly) {
1175
          this._setter = _setter;
1176
          this._dirty = true;
1177
          this.__v_isRef = true;
1178
          this.effect = effect(getter, {
1179
              lazy: true,
1180
              scheduler: () => {
1181
                  if (!this._dirty) {
1182
                      this._dirty = true;
1183
                      trigger(toRaw(this), "set" /* SET */, 'value');
1184
                  }
1185
              }
1186
          });
1187
          this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1188
      }
1189
      get value() {
1190
          if (this._dirty) {
1191
              this._value = this.effect();
1192
              this._dirty = false;
1193
          }
1194
          track(toRaw(this), "get" /* GET */, 'value');
1195
          return this._value;
1196
      }
1197
      set value(newValue) {
1198
          this._setter(newValue);
1199
      }
1200
  }
1201
  function computed(getterOrOptions) {
1202
      let getter;
1203
      let setter;
1204
      if (isFunction(getterOrOptions)) {
1205
          getter = getterOrOptions;
1206
          setter =  () => {
1207
                  console.warn('Write operation failed: computed value is readonly');
1208
              }
1209
              ;
1210
      }
1211
      else {
1212
          getter = getterOrOptions.get;
1213
          setter = getterOrOptions.set;
1214
      }
1215
      return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
1216
  }
1217
 
1218
  const stack = [];
1219
  function pushWarningContext(vnode) {
1220
      stack.push(vnode);
1221
  }
1222
  function popWarningContext() {
1223
      stack.pop();
1224
  }
1225
  function warn(msg, ...args) {
1226
      // avoid props formatting or warn handler tracking deps that might be mutated
1227
      // during patch, leading to infinite recursion.
1228
      pauseTracking();
1229
      const instance = stack.length ? stack[stack.length - 1].component : null;
1230
      const appWarnHandler = instance && instance.appContext.config.warnHandler;
1231
      const trace = getComponentTrace();
1232
      if (appWarnHandler) {
1233
          callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
1234
              msg + args.join(''),
1235
              instance && instance.proxy,
1236
              trace
1237
                  .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
1238
                  .join('\n'),
1239
              trace
1240
          ]);
1241
      }
1242
      else {
1243
          const warnArgs = [`[Vue warn]: ${msg}`, ...args];
1244
          /* istanbul ignore if */
1245
          if (trace.length &&
1246
              // avoid spamming console during tests
1247
              !false) {
1248
              warnArgs.push(`\n`, ...formatTrace(trace));
1249
          }
1250
          console.warn(...warnArgs);
1251
      }
1252
      resetTracking();
1253
  }
1254
  function getComponentTrace() {
1255
      let currentVNode = stack[stack.length - 1];
1256
      if (!currentVNode) {
1257
          return [];
1258
      }
1259
      // we can't just use the stack because it will be incomplete during updates
1260
      // that did not start from the root. Re-construct the parent chain using
1261
      // instance parent pointers.
1262
      const normalizedStack = [];
1263
      while (currentVNode) {
1264
          const last = normalizedStack[0];
1265
          if (last && last.vnode === currentVNode) {
1266
              last.recurseCount++;
1267
          }
1268
          else {
1269
              normalizedStack.push({
1270
                  vnode: currentVNode,
1271
                  recurseCount: 0
1272
              });
1273
          }
1274
          const parentInstance = currentVNode.component && currentVNode.component.parent;
1275
          currentVNode = parentInstance && parentInstance.vnode;
1276
      }
1277
      return normalizedStack;
1278
  }
1279
  /* istanbul ignore next */
1280
  function formatTrace(trace) {
1281
      const logs = [];
1282
      trace.forEach((entry, i) => {
1283
          logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
1284
      });
1285
      return logs;
1286
  }
1287
  function formatTraceEntry({ vnode, recurseCount }) {
1288
      const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
1289
      const isRoot = vnode.component ? vnode.component.parent == null : false;
1290
      const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
1291
      const close = `>` + postfix;
1292
      return vnode.props
1293
          ? [open, ...formatProps(vnode.props), close]
1294
          : [open + close];
1295
  }
1296
  /* istanbul ignore next */
1297
  function formatProps(props) {
1298
      const res = [];
1299
      const keys = Object.keys(props);
1300
      keys.slice(0, 3).forEach(key => {
1301
          res.push(...formatProp(key, props[key]));
1302
      });
1303
      if (keys.length > 3) {
1304
          res.push(` ...`);
1305
      }
1306
      return res;
1307
  }
1308
  /* istanbul ignore next */
1309
  function formatProp(key, value, raw) {
1310
      if (isString(value)) {
1311
          value = JSON.stringify(value);
1312
          return raw ? value : [`${key}=${value}`];
1313
      }
1314
      else if (typeof value === 'number' ||
1315
          typeof value === 'boolean' ||
1316
          value == null) {
1317
          return raw ? value : [`${key}=${value}`];
1318
      }
1319
      else if (isRef(value)) {
1320
          value = formatProp(key, toRaw(value.value), true);
1321
          return raw ? value : [`${key}=Ref<`, value, `>`];
1322
      }
1323
      else if (isFunction(value)) {
1324
          return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1325
      }
1326
      else {
1327
          value = toRaw(value);
1328
          return raw ? value : [`${key}=`, value];
1329
      }
1330
  }
1331
 
1332
  const ErrorTypeStrings = {
1333
      ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
1334
      ["c" /* CREATED */]: 'created hook',
1335
      ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
1336
      ["m" /* MOUNTED */]: 'mounted hook',
1337
      ["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
1338
      ["u" /* UPDATED */]: 'updated',
1339
      ["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
1340
      ["um" /* UNMOUNTED */]: 'unmounted hook',
1341
      ["a" /* ACTIVATED */]: 'activated hook',
1342
      ["da" /* DEACTIVATED */]: 'deactivated hook',
1343
      ["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
1344
      ["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
1345
      ["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
1346
      [0 /* SETUP_FUNCTION */]: 'setup function',
1347
      [1 /* RENDER_FUNCTION */]: 'render function',
1348
      [2 /* WATCH_GETTER */]: 'watcher getter',
1349
      [3 /* WATCH_CALLBACK */]: 'watcher callback',
1350
      [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
1351
      [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
1352
      [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
1353
      [7 /* VNODE_HOOK */]: 'vnode hook',
1354
      [8 /* DIRECTIVE_HOOK */]: 'directive hook',
1355
      [9 /* TRANSITION_HOOK */]: 'transition hook',
1356
      [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
1357
      [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
1358
      [12 /* FUNCTION_REF */]: 'ref function',
1359
      [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1360
      [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1361
          'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
1362
  };
1363
  function callWithErrorHandling(fn, instance, type, args) {
1364
      let res;
1365
      try {
1366
          res = args ? fn(...args) : fn();
1367
      }
1368
      catch (err) {
1369
          handleError(err, instance, type);
1370
      }
1371
      return res;
1372
  }
1373
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1374
      if (isFunction(fn)) {
1375
          const res = callWithErrorHandling(fn, instance, type, args);
1376
          if (res && isPromise(res)) {
1377
              res.catch(err => {
1378
                  handleError(err, instance, type);
1379
              });
1380
          }
1381
          return res;
1382
      }
1383
      const values = [];
1384
      for (let i = 0; i < fn.length; i++) {
1385
          values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1386
      }
1387
      return values;
1388
  }
1389
  function handleError(err, instance, type, throwInDev = true) {
1390
      const contextVNode = instance ? instance.vnode : null;
1391
      if (instance) {
1392
          let cur = instance.parent;
1393
          // the exposed instance is the render proxy to keep it consistent with 2.x
1394
          const exposedInstance = instance.proxy;
1395
          // in production the hook receives only the error code
1396
          const errorInfo =  ErrorTypeStrings[type] ;
1397
          while (cur) {
1398
              const errorCapturedHooks = cur.ec;
1399
              if (errorCapturedHooks) {
1400
                  for (let i = 0; i < errorCapturedHooks.length; i++) {
1401
                      if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1402
                          return;
1403
                      }
1404
                  }
1405
              }
1406
              cur = cur.parent;
1407
          }
1408
          // app-level handling
1409
          const appErrorHandler = instance.appContext.config.errorHandler;
1410
          if (appErrorHandler) {
1411
              callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
1412
              return;
1413
          }
1414
      }
1415
      logError(err, type, contextVNode, throwInDev);
1416
  }
1417
  function logError(err, type, contextVNode, throwInDev = true) {
1418
      {
1419
          const info = ErrorTypeStrings[type];
1420
          if (contextVNode) {
1421
              pushWarningContext(contextVNode);
1422
          }
1423
          warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1424
          if (contextVNode) {
1425
              popWarningContext();
1426
          }
1427
          // crash in dev by default so it's more noticeable
1428
          if (throwInDev) {
1429
              throw err;
1430
          }
1431
          else {
1432
              console.error(err);
1433
          }
1434
      }
1435
  }
1436
 
1437
  let isFlushing = false;
1438
  let isFlushPending = false;
1439
  const queue = [];
1440
  let flushIndex = 0;
1441
  const pendingPreFlushCbs = [];
1442
  let activePreFlushCbs = null;
1443
  let preFlushIndex = 0;
1444
  const pendingPostFlushCbs = [];
1445
  let activePostFlushCbs = null;
1446
  let postFlushIndex = 0;
1447
  const resolvedPromise = Promise.resolve();
1448
  let currentFlushPromise = null;
1449
  let currentPreFlushParentJob = null;
1450
  const RECURSION_LIMIT = 100;
1451
  function nextTick(fn) {
1452
      const p = currentFlushPromise || resolvedPromise;
1453
      return fn ? p.then(this ? fn.bind(this) : fn) : p;
1454
  }
1455
  function queueJob(job) {
1456
      // the dedupe search uses the startIndex argument of Array.includes()
1457
      // by default the search index includes the current job that is being run
1458
      // so it cannot recursively trigger itself again.
1459
      // if the job is a watch() callback, the search will start with a +1 index to
1460
      // allow it recursively trigger itself - it is the user's responsibility to
1461
      // ensure it doesn't end up in an infinite loop.
1462
      if ((!queue.length ||
1463
          !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
1464
          job !== currentPreFlushParentJob) {
1465
          queue.push(job);
1466
          queueFlush();
1467
      }
1468
  }
1469
  function queueFlush() {
1470
      if (!isFlushing && !isFlushPending) {
1471
          isFlushPending = true;
1472
          currentFlushPromise = resolvedPromise.then(flushJobs);
1473
      }
1474
  }
1475
  function invalidateJob(job) {
1476
      const i = queue.indexOf(job);
1477
      if (i > -1) {
1478
          queue.splice(i, 1);
1479
      }
1480
  }
1481
  function queueCb(cb, activeQueue, pendingQueue, index) {
1482
      if (!isArray(cb)) {
1483
          if (!activeQueue ||
1484
              !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
1485
              pendingQueue.push(cb);
1486
          }
1487
      }
1488
      else {
1489
          // if cb is an array, it is a component lifecycle hook which can only be
1490
          // triggered by a job, which is already deduped in the main queue, so
1491
          // we can skip duplicate check here to improve perf
1492
          pendingQueue.push(...cb);
1493
      }
1494
      queueFlush();
1495
  }
1496
  function queuePreFlushCb(cb) {
1497
      queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
1498
  }
1499
  function queuePostFlushCb(cb) {
1500
      queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
1501
  }
1502
  function flushPreFlushCbs(seen, parentJob = null) {
1503
      if (pendingPreFlushCbs.length) {
1504
          currentPreFlushParentJob = parentJob;
1505
          activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
1506
          pendingPreFlushCbs.length = 0;
1507
          {
1508
              seen = seen || new Map();
1509
          }
1510
          for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
1511
              {
1512
                  checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex]);
1513
              }
1514
              activePreFlushCbs[preFlushIndex]();
1515
          }
1516
          activePreFlushCbs = null;
1517
          preFlushIndex = 0;
1518
          currentPreFlushParentJob = null;
1519
          // recursively flush until it drains
1520
          flushPreFlushCbs(seen, parentJob);
1521
      }
1522
  }
1523
  function flushPostFlushCbs(seen) {
1524
      if (pendingPostFlushCbs.length) {
1525
          const deduped = [...new Set(pendingPostFlushCbs)];
1526
          pendingPostFlushCbs.length = 0;
1527
          // #1947 already has active queue, nested flushPostFlushCbs call
1528
          if (activePostFlushCbs) {
1529
              activePostFlushCbs.push(...deduped);
1530
              return;
1531
          }
1532
          activePostFlushCbs = deduped;
1533
          {
1534
              seen = seen || new Map();
1535
          }
1536
          activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1537
          for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1538
              {
1539
                  checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex]);
1540
              }
1541
              activePostFlushCbs[postFlushIndex]();
1542
          }
1543
          activePostFlushCbs = null;
1544
          postFlushIndex = 0;
1545
      }
1546
  }
1547
  const getId = (job) => job.id == null ? Infinity : job.id;
1548
  function flushJobs(seen) {
1549
      isFlushPending = false;
1550
      isFlushing = true;
1551
      {
1552
          seen = seen || new Map();
1553
      }
1554
      flushPreFlushCbs(seen);
1555
      // Sort queue before flush.
1556
      // This ensures that:
1557
      // 1. Components are updated from parent to child. (because parent is always
1558
      //    created before the child so its render effect will have smaller
1559
      //    priority number)
1560
      // 2. If a component is unmounted during a parent component's update,
1561
      //    its update can be skipped.
1562
      queue.sort((a, b) => getId(a) - getId(b));
1563
      try {
1564
          for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1565
              const job = queue[flushIndex];
1566
              if (job) {
1567
                  if (true) {
1568
                      checkRecursiveUpdates(seen, job);
1569
                  }
1570
                  callWithErrorHandling(job, null, 14 /* SCHEDULER */);
1571
              }
1572
          }
1573
      }
1574
      finally {
1575
          flushIndex = 0;
1576
          queue.length = 0;
1577
          flushPostFlushCbs(seen);
1578
          isFlushing = false;
1579
          currentFlushPromise = null;
1580
          // some postFlushCb queued jobs!
1581
          // keep flushing until it drains.
1582
          if (queue.length || pendingPostFlushCbs.length) {
1583
              flushJobs(seen);
1584
          }
1585
      }
1586
  }
1587
  function checkRecursiveUpdates(seen, fn) {
1588
      if (!seen.has(fn)) {
1589
          seen.set(fn, 1);
1590
      }
1591
      else {
1592
          const count = seen.get(fn);
1593
          if (count > RECURSION_LIMIT) {
1594
              throw new Error(`Maximum recursive updates exceeded. ` +
1595
                  `This means you have a reactive effect that is mutating its own ` +
1596
                  `dependencies and thus recursively triggering itself. Possible sources ` +
1597
                  `include component template, render function, updated hook or ` +
1598
                  `watcher source function.`);
1599
          }
1600
          else {
1601
              seen.set(fn, count + 1);
1602
          }
1603
      }
1604
  }
1605
 
1606
  /* eslint-disable no-restricted-globals */
1607
  let isHmrUpdating = false;
1608
  const hmrDirtyComponents = new Set();
1609
  // Expose the HMR runtime on the global object
1610
  // This makes it entirely tree-shakable without polluting the exports and makes
1611
  // it easier to be used in toolings like vue-loader
1612
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1613
  // to be set so that its instances can be registered / removed.
1614
  {
1615
      const globalObject = typeof global !== 'undefined'
1616
          ? global
1617
          : typeof self !== 'undefined'
1618
              ? self
1619
              : typeof window !== 'undefined'
1620
                  ? window
1621
                  : {};
1622
      globalObject.__VUE_HMR_RUNTIME__ = {
1623
          createRecord: tryWrap(createRecord),
1624
          rerender: tryWrap(rerender),
1625
          reload: tryWrap(reload)
1626
      };
1627
  }
1628
  const map = new Map();
1629
  function registerHMR(instance) {
1630
      const id = instance.type.__hmrId;
1631
      let record = map.get(id);
1632
      if (!record) {
1633
          createRecord(id, instance.type);
1634
          record = map.get(id);
1635
      }
1636
      record.instances.add(instance);
1637
  }
1638
  function unregisterHMR(instance) {
1639
      map.get(instance.type.__hmrId).instances.delete(instance);
1640
  }
1641
  function createRecord(id, component) {
1642
      if (!component) {
1643
          warn(`HMR API usage is out of date.\n` +
1644
              `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1645
              `depdendency that handles Vue SFC compilation.`);
1646
          component = {};
1647
      }
1648
      if (map.has(id)) {
1649
          return false;
1650
      }
1651
      map.set(id, {
1652
          component: isClassComponent(component) ? component.__vccOpts : component,
1653
          instances: new Set()
1654
      });
1655
      return true;
1656
  }
1657
  function rerender(id, newRender) {
1658
      const record = map.get(id);
1659
      if (!record)
1660
          return;
1661
      if (newRender)
1662
          record.component.render = newRender;
1663
      // Array.from creates a snapshot which avoids the set being mutated during
1664
      // updates
1665
      Array.from(record.instances).forEach(instance => {
1666
          if (newRender) {
1667
              instance.render = newRender;
1668
          }
1669
          instance.renderCache = [];
1670
          // this flag forces child components with slot content to update
1671
          isHmrUpdating = true;
1672
          instance.update();
1673
          isHmrUpdating = false;
1674
      });
1675
  }
1676
  function reload(id, newComp) {
1677
      const record = map.get(id);
1678
      if (!record)
1679
          return;
1680
      // Array.from creates a snapshot which avoids the set being mutated during
1681
      // updates
1682
      const { component, instances } = record;
1683
      if (!hmrDirtyComponents.has(component)) {
1684
          // 1. Update existing comp definition to match new one
1685
          newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1686
          extend(component, newComp);
1687
          for (const key in component) {
1688
              if (!(key in newComp)) {
1689
                  delete component[key];
1690
              }
1691
          }
1692
          // 2. Mark component dirty. This forces the renderer to replace the component
1693
          // on patch.
1694
          hmrDirtyComponents.add(component);
1695
          // 3. Make sure to unmark the component after the reload.
1696
          queuePostFlushCb(() => {
1697
              hmrDirtyComponents.delete(component);
1698
          });
1699
      }
1700
      Array.from(instances).forEach(instance => {
1701
          if (instance.parent) {
1702
              // 4. Force the parent instance to re-render. This will cause all updated
1703
              // components to be unmounted and re-mounted. Queue the update so that we
1704
              // don't end up forcing the same parent to re-render multiple times.
1705
              queueJob(instance.parent.update);
1706
          }
1707
          else if (instance.appContext.reload) {
1708
              // root instance mounted via createApp() has a reload method
1709
              instance.appContext.reload();
1710
          }
1711
          else if (typeof window !== 'undefined') {
1712
              // root instance inside tree created via raw render(). Force reload.
1713
              window.location.reload();
1714
          }
1715
          else {
1716
              console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1717
          }
1718
      });
1719
  }
1720
  function tryWrap(fn) {
1721
      return (id, arg) => {
1722
          try {
1723
              return fn(id, arg);
1724
          }
1725
          catch (e) {
1726
              console.error(e);
1727
              console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +
1728
                  `Full reload required.`);
1729
          }
1730
      };
1731
  }
1732
 
1733
  function setDevtoolsHook(hook) {
1734
      exports.devtools = hook;
1735
  }
1736
  function devtoolsInitApp(app, version) {
1737
      // TODO queue if devtools is undefined
1738
      if (!exports.devtools)
1739
          return;
1740
      exports.devtools.emit("app:init" /* APP_INIT */, app, version, {
1741
          Fragment,
1742
          Text,
1743
          Comment,
1744
          Static
1745
      });
1746
  }
1747
  function devtoolsUnmountApp(app) {
1748
      if (!exports.devtools)
1749
          return;
1750
      exports.devtools.emit("app:unmount" /* APP_UNMOUNT */, app);
1751
  }
1752
  const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
1753
  const devtoolsComponentUpdated = /*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
1754
  const devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
1755
  function createDevtoolsComponentHook(hook) {
1756
      return (component) => {
1757
          if (!exports.devtools)
1758
              return;
1759
          exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
1760
      };
1761
  }
1762
  function devtoolsComponentEmit(component, event, params) {
1763
      if (!exports.devtools)
1764
          return;
1765
      exports.devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1766
  }
1767
 
1768
  function emit(instance, event, ...rawArgs) {
1769
      const props = instance.vnode.props || EMPTY_OBJ;
1770
      {
1771
          const { emitsOptions, propsOptions: [propsOptions] } = instance;
1772
          if (emitsOptions) {
1773
              if (!(event in emitsOptions)) {
1774
                  if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
1775
                      warn(`Component emitted event "${event}" but it is neither declared in ` +
1776
                          `the emits option nor as an "${toHandlerKey(event)}" prop.`);
1777
                  }
1778
              }
1779
              else {
1780
                  const validator = emitsOptions[event];
1781
                  if (isFunction(validator)) {
1782
                      const isValid = validator(...rawArgs);
1783
                      if (!isValid) {
1784
                          warn(`Invalid event arguments: event validation failed for event "${event}".`);
1785
                      }
1786
                  }
1787
              }
1788
          }
1789
      }
1790
      let args = rawArgs;
1791
      const isModelListener = event.startsWith('update:');
1792
      // for v-model update:xxx events, apply modifiers on args
1793
      const modelArg = isModelListener && event.slice(7);
1794
      if (modelArg && modelArg in props) {
1795
          const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
1796
          const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
1797
          if (trim) {
1798
              args = rawArgs.map(a => a.trim());
1799
          }
1800
          else if (number) {
1801
              args = rawArgs.map(toNumber);
1802
          }
1803
      }
1804
      {
1805
          devtoolsComponentEmit(instance, event, args);
1806
      }
1807
      {
1808
          const lowerCaseEvent = event.toLowerCase();
1809
          if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
1810
              warn(`Event "${lowerCaseEvent}" is emitted in component ` +
1811
                  `${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". ` +
1812
                  `Note that HTML attributes are case-insensitive and you cannot use ` +
1813
                  `v-on to listen to camelCase events when using in-DOM templates. ` +
1814
                  `You should probably use "${hyphenate(event)}" instead of "${event}".`);
1815
          }
1816
      }
1817
      // convert handler name to camelCase. See issue #2249
1818
      let handlerName = toHandlerKey(camelize(event));
1819
      let handler = props[handlerName];
1820
      // for v-model update:xxx events, also trigger kebab-case equivalent
1821
      // for props passed via kebab-case
1822
      if (!handler && isModelListener) {
1823
          handlerName = toHandlerKey(hyphenate(event));
1824
          handler = props[handlerName];
1825
      }
1826
      if (handler) {
1827
          callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
1828
      }
1829
      const onceHandler = props[handlerName + `Once`];
1830
      if (onceHandler) {
1831
          if (!instance.emitted) {
1832
              (instance.emitted = {})[handlerName] = true;
1833
          }
1834
          else if (instance.emitted[handlerName]) {
1835
              return;
1836
          }
1837
          callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
1838
      }
1839
  }
1840
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1841
      if (!appContext.deopt && comp.__emits !== undefined) {
1842
          return comp.__emits;
1843
      }
1844
      const raw = comp.emits;
1845
      let normalized = {};
1846
      // apply mixin/extends props
1847
      let hasExtends = false;
1848
      if ( !isFunction(comp)) {
1849
          const extendEmits = (raw) => {
1850
              hasExtends = true;
1851
              extend(normalized, normalizeEmitsOptions(raw, appContext, true));
1852
          };
1853
          if (!asMixin && appContext.mixins.length) {
1854
              appContext.mixins.forEach(extendEmits);
1855
          }
1856
          if (comp.extends) {
1857
              extendEmits(comp.extends);
1858
          }
1859
          if (comp.mixins) {
1860
              comp.mixins.forEach(extendEmits);
1861
          }
1862
      }
1863
      if (!raw && !hasExtends) {
1864
          return (comp.__emits = null);
1865
      }
1866
      if (isArray(raw)) {
1867
          raw.forEach(key => (normalized[key] = null));
1868
      }
1869
      else {
1870
          extend(normalized, raw);
1871
      }
1872
      return (comp.__emits = normalized);
1873
  }
1874
  // Check if an incoming prop key is a declared emit event listener.
1875
  // e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
1876
  // both considered matched listeners.
1877
  function isEmitListener(options, key) {
1878
      if (!options || !isOn(key)) {
1879
          return false;
1880
      }
1881
      key = key.slice(2).replace(/Once$/, '');
1882
      return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
1883
          hasOwn(options, hyphenate(key)) ||
1884
          hasOwn(options, key));
1885
  }
1886
 
1887
  /**
1888
   * mark the current rendering instance for asset resolution (e.g.
1889
   * resolveComponent, resolveDirective) during render
1890
   */
1891
  let currentRenderingInstance = null;
1892
  function setCurrentRenderingInstance(instance) {
1893
      currentRenderingInstance = instance;
1894
  }
1895
  /**
1896
   * dev only flag to track whether $attrs was used during render.
1897
   * If $attrs was used during render then the warning for failed attrs
1898
   * fallthrough can be suppressed.
1899
   */
1900
  let accessedAttrs = false;
1901
  function markAttrsAccessed() {
1902
      accessedAttrs = true;
1903
  }
1904
  function renderComponentRoot(instance) {
1905
      const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;
1906
      let result;
1907
      currentRenderingInstance = instance;
1908
      {
1909
          accessedAttrs = false;
1910
      }
1911
      try {
1912
          let fallthroughAttrs;
1913
          if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
1914
              // withProxy is a proxy with a different `has` trap only for
1915
              // runtime-compiled render functions using `with` block.
1916
              const proxyToUse = withProxy || proxy;
1917
              result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
1918
              fallthroughAttrs = attrs;
1919
          }
1920
          else {
1921
              // functional
1922
              const render = Component;
1923
              // in dev, mark attrs accessed if optional props (attrs === props)
1924
              if (true && attrs === props) {
1925
                  markAttrsAccessed();
1926
              }
1927
              result = normalizeVNode(render.length > 1
1928
                  ? render(props, true
1929
                      ? {
1930
                          get attrs() {
1931
                              markAttrsAccessed();
1932
                              return attrs;
1933
                          },
1934
                          slots,
1935
                          emit
1936
                      }
1937
                      : { attrs, slots, emit })
1938
                  : render(props, null /* we know it doesn't need it */));
1939
              fallthroughAttrs = Component.props
1940
                  ? attrs
1941
                  : getFunctionalFallthrough(attrs);
1942
          }
1943
          // attr merging
1944
          // in dev mode, comments are preserved, and it's possible for a template
1945
          // to have comments along side the root element which makes it a fragment
1946
          let root = result;
1947
          let setRoot = undefined;
1948
          if (true && result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
1949
              ;
1950
              [root, setRoot] = getChildRoot(result);
1951
          }
1952
          if (Component.inheritAttrs !== false && fallthroughAttrs) {
1953
              const keys = Object.keys(fallthroughAttrs);
1954
              const { shapeFlag } = root;
1955
              if (keys.length) {
1956
                  if (shapeFlag & 1 /* ELEMENT */ ||
1957
                      shapeFlag & 6 /* COMPONENT */) {
1958
                      if (propsOptions && keys.some(isModelListener)) {
1959
                          // If a v-model listener (onUpdate:xxx) has a corresponding declared
1960
                          // prop, it indicates this component expects to handle v-model and
1961
                          // it should not fallthrough.
1962
                          // related: #1543, #1643, #1989
1963
                          fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
1964
                      }
1965
                      root = cloneVNode(root, fallthroughAttrs);
1966
                  }
1967
                  else if (true && !accessedAttrs && root.type !== Comment) {
1968
                      const allAttrs = Object.keys(attrs);
1969
                      const eventAttrs = [];
1970
                      const extraAttrs = [];
1971
                      for (let i = 0, l = allAttrs.length; i < l; i++) {
1972
                          const key = allAttrs[i];
1973
                          if (isOn(key)) {
1974
                              // ignore v-model handlers when they fail to fallthrough
1975
                              if (!isModelListener(key)) {
1976
                                  // remove `on`, lowercase first letter to reflect event casing
1977
                                  // accurately
1978
                                  eventAttrs.push(key[2].toLowerCase() + key.slice(3));
1979
                              }
1980
                          }
1981
                          else {
1982
                              extraAttrs.push(key);
1983
                          }
1984
                      }
1985
                      if (extraAttrs.length) {
1986
                          warn(`Extraneous non-props attributes (` +
1987
                              `${extraAttrs.join(', ')}) ` +
1988
                              `were passed to component but could not be automatically inherited ` +
1989
                              `because component renders fragment or text root nodes.`);
1990
                      }
1991
                      if (eventAttrs.length) {
1992
                          warn(`Extraneous non-emits event listeners (` +
1993
                              `${eventAttrs.join(', ')}) ` +
1994
                              `were passed to component but could not be automatically inherited ` +
1995
                              `because component renders fragment or text root nodes. ` +
1996
                              `If the listener is intended to be a component custom event listener only, ` +
1997
                              `declare it using the "emits" option.`);
1998
                      }
1999
                  }
2000
              }
2001
          }
2002
          // inherit directives
2003
          if (vnode.dirs) {
2004
              if (true && !isElementRoot(root)) {
2005
                  warn(`Runtime directive used on component with non-element root node. ` +
2006
                      `The directives will not function as intended.`);
2007
              }
2008
              root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2009
          }
2010
          // inherit transition data
2011
          if (vnode.transition) {
2012
              if (true && !isElementRoot(root)) {
2013
                  warn(`Component inside <Transition> renders non-element root node ` +
2014
                      `that cannot be animated.`);
2015
              }
2016
              root.transition = vnode.transition;
2017
          }
2018
          if (true && setRoot) {
2019
              setRoot(root);
2020
          }
2021
          else {
2022
              result = root;
2023
          }
2024
      }
2025
      catch (err) {
2026
          handleError(err, instance, 1 /* RENDER_FUNCTION */);
2027
          result = createVNode(Comment);
2028
      }
2029
      currentRenderingInstance = null;
2030
      return result;
2031
  }
2032
  /**
2033
   * dev only
2034
   * In dev mode, template root level comments are rendered, which turns the
2035
   * template into a fragment root, but we need to locate the single element
2036
   * root for attrs and scope id processing.
2037
   */
2038
  const getChildRoot = (vnode) => {
2039
      const rawChildren = vnode.children;
2040
      const dynamicChildren = vnode.dynamicChildren;
2041
      const childRoot = filterSingleRoot(rawChildren);
2042
      if (!childRoot) {
2043
          return [vnode, undefined];
2044
      }
2045
      const index = rawChildren.indexOf(childRoot);
2046
      const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
2047
      const setRoot = (updatedRoot) => {
2048
          rawChildren[index] = updatedRoot;
2049
          if (dynamicChildren) {
2050
              if (dynamicIndex > -1) {
2051
                  dynamicChildren[dynamicIndex] = updatedRoot;
2052
              }
2053
              else if (updatedRoot.patchFlag > 0) {
2054
                  vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
2055
              }
2056
          }
2057
      };
2058
      return [normalizeVNode(childRoot), setRoot];
2059
  };
2060
  function filterSingleRoot(children) {
2061
      let singleRoot;
2062
      for (let i = 0; i < children.length; i++) {
2063
          const child = children[i];
2064
          if (isVNode(child)) {
2065
              // ignore user comment
2066
              if (child.type !== Comment || child.children === 'v-if') {
2067
                  if (singleRoot) {
2068
                      // has more than 1 non-comment child, return now
2069
                      return;
2070
                  }
2071
                  else {
2072
                      singleRoot = child;
2073
                  }
2074
              }
2075
          }
2076
          else {
2077
              return;
2078
          }
2079
      }
2080
      return singleRoot;
2081
  }
2082
  const getFunctionalFallthrough = (attrs) => {
2083
      let res;
2084
      for (const key in attrs) {
2085
          if (key === 'class' || key === 'style' || isOn(key)) {
2086
              (res || (res = {}))[key] = attrs[key];
2087
          }
2088
      }
2089
      return res;
2090
  };
2091
  const filterModelListeners = (attrs, props) => {
2092
      const res = {};
2093
      for (const key in attrs) {
2094
          if (!isModelListener(key) || !(key.slice(9) in props)) {
2095
              res[key] = attrs[key];
2096
          }
2097
      }
2098
      return res;
2099
  };
2100
  const isElementRoot = (vnode) => {
2101
      return (vnode.shapeFlag & 6 /* COMPONENT */ ||
2102
          vnode.shapeFlag & 1 /* ELEMENT */ ||
2103
          vnode.type === Comment // potential v-if branch switch
2104
      );
2105
  };
2106
  function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2107
      const { props: prevProps, children: prevChildren, component } = prevVNode;
2108
      const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
2109
      const emits = component.emitsOptions;
2110
      // Parent component's render function was hot-updated. Since this may have
2111
      // caused the child component's slots content to have changed, we need to
2112
      // force the child to update as well.
2113
      if ( (prevChildren || nextChildren) && isHmrUpdating) {
2114
          return true;
2115
      }
2116
      // force child update for runtime directive or transition on component vnode.
2117
      if (nextVNode.dirs || nextVNode.transition) {
2118
          return true;
2119
      }
2120
      if (optimized && patchFlag >= 0) {
2121
          if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
2122
              // slot content that references values that might have changed,
2123
              // e.g. in a v-for
2124
              return true;
2125
          }
2126
          if (patchFlag & 16 /* FULL_PROPS */) {
2127
              if (!prevProps) {
2128
                  return !!nextProps;
2129
              }
2130
              // presence of this flag indicates props are always non-null
2131
              return hasPropsChanged(prevProps, nextProps, emits);
2132
          }
2133
          else if (patchFlag & 8 /* PROPS */) {
2134
              const dynamicProps = nextVNode.dynamicProps;
2135
              for (let i = 0; i < dynamicProps.length; i++) {
2136
                  const key = dynamicProps[i];
2137
                  if (nextProps[key] !== prevProps[key] &&
2138
                      !isEmitListener(emits, key)) {
2139
                      return true;
2140
                  }
2141
              }
2142
          }
2143
      }
2144
      else {
2145
          // this path is only taken by manually written render functions
2146
          // so presence of any children leads to a forced update
2147
          if (prevChildren || nextChildren) {
2148
              if (!nextChildren || !nextChildren.$stable) {
2149
                  return true;
2150
              }
2151
          }
2152
          if (prevProps === nextProps) {
2153
              return false;
2154
          }
2155
          if (!prevProps) {
2156
              return !!nextProps;
2157
          }
2158
          if (!nextProps) {
2159
              return true;
2160
          }
2161
          return hasPropsChanged(prevProps, nextProps, emits);
2162
      }
2163
      return false;
2164
  }
2165
  function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2166
      const nextKeys = Object.keys(nextProps);
2167
      if (nextKeys.length !== Object.keys(prevProps).length) {
2168
          return true;
2169
      }
2170
      for (let i = 0; i < nextKeys.length; i++) {
2171
          const key = nextKeys[i];
2172
          if (nextProps[key] !== prevProps[key] &&
2173
              !isEmitListener(emitsOptions, key)) {
2174
              return true;
2175
          }
2176
      }
2177
      return false;
2178
  }
2179
  function updateHOCHostEl({ vnode, parent }, el // HostNode
2180
  ) {
2181
      while (parent && parent.subTree === vnode) {
2182
          (vnode = parent.vnode).el = el;
2183
          parent = parent.parent;
2184
      }
2185
  }
2186
 
2187
  const isSuspense = (type) => type.__isSuspense;
2188
  // Suspense exposes a component-like API, and is treated like a component
2189
  // in the compiler, but internally it's a special built-in type that hooks
2190
  // directly into the renderer.
2191
  const SuspenseImpl = {
2192
      // In order to make Suspense tree-shakable, we need to avoid importing it
2193
      // directly in the renderer. The renderer checks for the __isSuspense flag
2194
      // on a vnode's type and calls the `process` method, passing in renderer
2195
      // internals.
2196
      __isSuspense: true,
2197
      process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized,
2198
      // platform-specific impl passed from renderer
2199
      rendererInternals) {
2200
          if (n1 == null) {
2201
              mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals);
2202
          }
2203
          else {
2204
              patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, rendererInternals);
2205
          }
2206
      },
2207
      hydrate: hydrateSuspense,
2208
      create: createSuspenseBoundary
2209
  };
2210
  // Force-casted public typing for h and TSX props inference
2211
  const Suspense = ( SuspenseImpl
2212
      );
2213
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals) {
2214
      const { p: patch, o: { createElement } } = rendererInternals;
2215
      const hiddenContainer = createElement('div');
2216
      const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals));
2217
      // start mounting the content subtree in an off-dom container
2218
      patch(null, (suspense.pendingBranch = vnode.ssContent), hiddenContainer, null, parentComponent, suspense, isSVG);
2219
      // now check if we have encountered any async deps
2220
      if (suspense.deps > 0) {
2221
          // has async
2222
          // mount the fallback tree
2223
          patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
2224
          isSVG);
2225
          setActiveBranch(suspense, vnode.ssFallback);
2226
      }
2227
      else {
2228
          // Suspense has no async deps. Just resolve.
2229
          suspense.resolve();
2230
      }
2231
  }
2232
  function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, { p: patch, um: unmount, o: { createElement } }) {
2233
      const suspense = (n2.suspense = n1.suspense);
2234
      suspense.vnode = n2;
2235
      n2.el = n1.el;
2236
      const newBranch = n2.ssContent;
2237
      const newFallback = n2.ssFallback;
2238
      const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
2239
      if (pendingBranch) {
2240
          suspense.pendingBranch = newBranch;
2241
          if (isSameVNodeType(newBranch, pendingBranch)) {
2242
              // same root type but content may have changed.
2243
              patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
2244
              if (suspense.deps <= 0) {
2245
                  suspense.resolve();
2246
              }
2247
              else if (isInFallback) {
2248
                  patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
2249
                  isSVG);
2250
                  setActiveBranch(suspense, newFallback);
2251
              }
2252
          }
2253
          else {
2254
              // toggled before pending tree is resolved
2255
              suspense.pendingId++;
2256
              if (isHydrating) {
2257
                  // if toggled before hydration is finished, the current DOM tree is
2258
                  // no longer valid. set it as the active branch so it will be unmounted
2259
                  // when resolved
2260
                  suspense.isHydrating = false;
2261
                  suspense.activeBranch = pendingBranch;
2262
              }
2263
              else {
2264
                  unmount(pendingBranch, parentComponent, suspense);
2265
              }
2266
              // increment pending ID. this is used to invalidate async callbacks
2267
              // reset suspense state
2268
              suspense.deps = 0;
2269
              // discard effects from pending branch
2270
              suspense.effects.length = 0;
2271
              // discard previous container
2272
              suspense.hiddenContainer = createElement('div');
2273
              if (isInFallback) {
2274
                  // already in fallback state
2275
                  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
2276
                  if (suspense.deps <= 0) {
2277
                      suspense.resolve();
2278
                  }
2279
                  else {
2280
                      patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
2281
                      isSVG);
2282
                      setActiveBranch(suspense, newFallback);
2283
                  }
2284
              }
2285
              else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2286
                  // toggled "back" to current active branch
2287
                  patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);
2288
                  // force resolve
2289
                  suspense.resolve(true);
2290
              }
2291
              else {
2292
                  // switched to a 3rd branch
2293
                  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
2294
                  if (suspense.deps <= 0) {
2295
                      suspense.resolve();
2296
                  }
2297
              }
2298
          }
2299
      }
2300
      else {
2301
          if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2302
              // root did not change, just normal patch
2303
              patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);
2304
              setActiveBranch(suspense, newBranch);
2305
          }
2306
          else {
2307
              // root node toggled
2308
              // invoke @pending event
2309
              const onPending = n2.props && n2.props.onPending;
2310
              if (isFunction(onPending)) {
2311
                  onPending();
2312
              }
2313
              // mount pending branch in off-dom container
2314
              suspense.pendingBranch = newBranch;
2315
              suspense.pendingId++;
2316
              patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);
2317
              if (suspense.deps <= 0) {
2318
                  // incoming branch has no async deps, resolve now.
2319
                  suspense.resolve();
2320
              }
2321
              else {
2322
                  const { timeout, pendingId } = suspense;
2323
                  if (timeout > 0) {
2324
                      setTimeout(() => {
2325
                          if (suspense.pendingId === pendingId) {
2326
                              suspense.fallback(newFallback);
2327
                          }
2328
                      }, timeout);
2329
                  }
2330
                  else if (timeout === 0) {
2331
                      suspense.fallback(newFallback);
2332
                  }
2333
              }
2334
          }
2335
      }
2336
  }
2337
  let hasWarned = false;
2338
  function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals, isHydrating = false) {
2339
      /* istanbul ignore if */
2340
      if ( !hasWarned) {
2341
          hasWarned = true;
2342
          // @ts-ignore `console.info` cannot be null error
2343
          console[console.info ? 'info' : 'log'](`<Suspense> is an experimental feature and its API will likely change.`);
2344
      }
2345
      const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;
2346
      const timeout = toNumber(vnode.props && vnode.props.timeout);
2347
      const suspense = {
2348
          vnode,
2349
          parent,
2350
          parentComponent,
2351
          isSVG,
2352
          container,
2353
          hiddenContainer,
2354
          anchor,
2355
          deps: 0,
2356
          pendingId: 0,
2357
          timeout: typeof timeout === 'number' ? timeout : -1,
2358
          activeBranch: null,
2359
          pendingBranch: null,
2360
          isInFallback: true,
2361
          isHydrating,
2362
          isUnmounted: false,
2363
          effects: [],
2364
          resolve(resume = false) {
2365
              {
2366
                  if (!resume && !suspense.pendingBranch) {
2367
                      throw new Error(`suspense.resolve() is called without a pending branch.`);
2368
                  }
2369
                  if (suspense.isUnmounted) {
2370
                      throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`);
2371
                  }
2372
              }
2373
              const { vnode, activeBranch, pendingBranch, pendingId, effects, parentComponent, container } = suspense;
2374
              if (suspense.isHydrating) {
2375
                  suspense.isHydrating = false;
2376
              }
2377
              else if (!resume) {
2378
                  const delayEnter = activeBranch &&
2379
                      pendingBranch.transition &&
2380
                      pendingBranch.transition.mode === 'out-in';
2381
                  if (delayEnter) {
2382
                      activeBranch.transition.afterLeave = () => {
2383
                          if (pendingId === suspense.pendingId) {
2384
                              move(pendingBranch, container, anchor, 0 /* ENTER */);
2385
                          }
2386
                      };
2387
                  }
2388
                  // this is initial anchor on mount
2389
                  let { anchor } = suspense;
2390
                  // unmount current active tree
2391
                  if (activeBranch) {
2392
                      // if the fallback tree was mounted, it may have been moved
2393
                      // as part of a parent suspense. get the latest anchor for insertion
2394
                      anchor = next(activeBranch);
2395
                      unmount(activeBranch, parentComponent, suspense, true);
2396
                  }
2397
                  if (!delayEnter) {
2398
                      // move content from off-dom container to actual container
2399
                      move(pendingBranch, container, anchor, 0 /* ENTER */);
2400
                  }
2401
              }
2402
              setActiveBranch(suspense, pendingBranch);
2403
              suspense.pendingBranch = null;
2404
              suspense.isInFallback = false;
2405
              // flush buffered effects
2406
              // check if there is a pending parent suspense
2407
              let parent = suspense.parent;
2408
              let hasUnresolvedAncestor = false;
2409
              while (parent) {
2410
                  if (parent.pendingBranch) {
2411
                      // found a pending parent suspense, merge buffered post jobs
2412
                      // into that parent
2413
                      parent.effects.push(...effects);
2414
                      hasUnresolvedAncestor = true;
2415
                      break;
2416
                  }
2417
                  parent = parent.parent;
2418
              }
2419
              // no pending parent suspense, flush all jobs
2420
              if (!hasUnresolvedAncestor) {
2421
                  queuePostFlushCb(effects);
2422
              }
2423
              suspense.effects = [];
2424
              // invoke @resolve event
2425
              const onResolve = vnode.props && vnode.props.onResolve;
2426
              if (isFunction(onResolve)) {
2427
                  onResolve();
2428
              }
2429
          },
2430
          fallback(fallbackVNode) {
2431
              if (!suspense.pendingBranch) {
2432
                  return;
2433
              }
2434
              const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
2435
              // invoke @fallback event
2436
              const onFallback = vnode.props && vnode.props.onFallback;
2437
              if (isFunction(onFallback)) {
2438
                  onFallback();
2439
              }
2440
              const anchor = next(activeBranch);
2441
              const mountFallback = () => {
2442
                  if (!suspense.isInFallback) {
2443
                      return;
2444
                  }
2445
                  // mount the fallback tree
2446
                  patch(null, fallbackVNode, container, anchor, parentComponent, null, // fallback tree will not have suspense context
2447
                  isSVG);
2448
                  setActiveBranch(suspense, fallbackVNode);
2449
              };
2450
              const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
2451
              if (delayEnter) {
2452
                  activeBranch.transition.afterLeave = mountFallback;
2453
              }
2454
              // unmount current active branch
2455
              unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now
2456
              true // shouldRemove
2457
              );
2458
              suspense.isInFallback = true;
2459
              if (!delayEnter) {
2460
                  mountFallback();
2461
              }
2462
          },
2463
          move(container, anchor, type) {
2464
              suspense.activeBranch &&
2465
                  move(suspense.activeBranch, container, anchor, type);
2466
              suspense.container = container;
2467
          },
2468
          next() {
2469
              return suspense.activeBranch && next(suspense.activeBranch);
2470
          },
2471
          registerDep(instance, setupRenderEffect) {
2472
              const isInPendingSuspense = !!suspense.pendingBranch;
2473
              if (isInPendingSuspense) {
2474
                  suspense.deps++;
2475
              }
2476
              const hydratedEl = instance.vnode.el;
2477
              instance
2478
                  .asyncDep.catch(err => {
2479
                  handleError(err, instance, 0 /* SETUP_FUNCTION */);
2480
              })
2481
                  .then(asyncSetupResult => {
2482
                  // retry when the setup() promise resolves.
2483
                  // component may have been unmounted before resolve.
2484
                  if (instance.isUnmounted ||
2485
                      suspense.isUnmounted ||
2486
                      suspense.pendingId !== instance.suspenseId) {
2487
                      return;
2488
                  }
2489
                  // retry from this component
2490
                  instance.asyncResolved = true;
2491
                  const { vnode } = instance;
2492
                  {
2493
                      pushWarningContext(vnode);
2494
                  }
2495
                  handleSetupResult(instance, asyncSetupResult);
2496
                  if (hydratedEl) {
2497
                      // vnode may have been replaced if an update happened before the
2498
                      // async dep is resolved.
2499
                      vnode.el = hydratedEl;
2500
                  }
2501
                  const placeholder = !hydratedEl && instance.subTree.el;
2502
                  setupRenderEffect(instance, vnode,
2503
                  // component may have been moved before resolve.
2504
                  // if this is not a hydration, instance.subTree will be the comment
2505
                  // placeholder.
2506
                  parentNode(hydratedEl || instance.subTree.el),
2507
                  // anchor will not be used if this is hydration, so only need to
2508
                  // consider the comment placeholder case.
2509
                  hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);
2510
                  if (placeholder) {
2511
                      remove(placeholder);
2512
                  }
2513
                  updateHOCHostEl(instance, vnode.el);
2514
                  {
2515
                      popWarningContext();
2516
                  }
2517
                  // only decrease deps count if suspense is not already resolved
2518
                  if (isInPendingSuspense && --suspense.deps === 0) {
2519
                      suspense.resolve();
2520
                  }
2521
              });
2522
          },
2523
          unmount(parentSuspense, doRemove) {
2524
              suspense.isUnmounted = true;
2525
              if (suspense.activeBranch) {
2526
                  unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
2527
              }
2528
              if (suspense.pendingBranch) {
2529
                  unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
2530
              }
2531
          }
2532
      };
2533
      return suspense;
2534
  }
2535
  function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, optimized, rendererInternals, hydrateNode) {
2536
      /* eslint-disable no-restricted-globals */
2537
      const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, optimized, rendererInternals, true /* hydrating */));
2538
      // there are two possible scenarios for server-rendered suspense:
2539
      // - success: ssr content should be fully resolved
2540
      // - failure: ssr content should be the fallback branch.
2541
      // however, on the client we don't really know if it has failed or not
2542
      // attempt to hydrate the DOM assuming it has succeeded, but we still
2543
      // need to construct a suspense boundary first
2544
      const result = hydrateNode(node, (suspense.pendingBranch = vnode.ssContent), parentComponent, suspense, optimized);
2545
      if (suspense.deps === 0) {
2546
          suspense.resolve();
2547
      }
2548
      return result;
2549
      /* eslint-enable no-restricted-globals */
2550
  }
2551
  function normalizeSuspenseChildren(vnode) {
2552
      const { shapeFlag, children } = vnode;
2553
      let content;
2554
      let fallback;
2555
      if (shapeFlag & 32 /* SLOTS_CHILDREN */) {
2556
          content = normalizeSuspenseSlot(children.default);
2557
          fallback = normalizeSuspenseSlot(children.fallback);
2558
      }
2559
      else {
2560
          content = normalizeSuspenseSlot(children);
2561
          fallback = normalizeVNode(null);
2562
      }
2563
      return {
2564
          content,
2565
          fallback
2566
      };
2567
  }
2568
  function normalizeSuspenseSlot(s) {
2569
      if (isFunction(s)) {
2570
          s = s();
2571
      }
2572
      if (isArray(s)) {
2573
          const singleChild = filterSingleRoot(s);
2574
          if ( !singleChild) {
2575
              warn(`<Suspense> slots expect a single root node.`);
2576
          }
2577
          s = singleChild;
2578
      }
2579
      return normalizeVNode(s);
2580
  }
2581
  function queueEffectWithSuspense(fn, suspense) {
2582
      if (suspense && suspense.pendingBranch) {
2583
          if (isArray(fn)) {
2584
              suspense.effects.push(...fn);
2585
          }
2586
          else {
2587
              suspense.effects.push(fn);
2588
          }
2589
      }
2590
      else {
2591
          queuePostFlushCb(fn);
2592
      }
2593
  }
2594
  function setActiveBranch(suspense, branch) {
2595
      suspense.activeBranch = branch;
2596
      const { vnode, parentComponent } = suspense;
2597
      const el = (vnode.el = branch.el);
2598
      // in case suspense is the root node of a component,
2599
      // recursively update the HOC el
2600
      if (parentComponent && parentComponent.subTree === vnode) {
2601
          parentComponent.vnode.el = el;
2602
          updateHOCHostEl(parentComponent, el);
2603
      }
2604
  }
2605
 
2606
  let isRenderingCompiledSlot = 0;
2607
  const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);
2608
  /**
2609
   * Compiler runtime helper for rendering `<slot/>`
2610
   * @private
2611
   */
2612
  function renderSlot(slots, name, props = {},
2613
  // this is not a user-facing function, so the fallback is always generated by
2614
  // the compiler and guaranteed to be a function returning an array
2615
  fallback) {
2616
      let slot = slots[name];
2617
      if ( slot && slot.length > 1) {
2618
          warn(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
2619
              `function. You need to mark this component with $dynamic-slots in the ` +
2620
              `parent template.`);
2621
          slot = () => [];
2622
      }
2623
      // a compiled slot disables block tracking by default to avoid manual
2624
      // invocation interfering with template-based block tracking, but in
2625
      // `renderSlot` we can be sure that it's template-based so we can force
2626
      // enable it.
2627
      isRenderingCompiledSlot++;
2628
      openBlock();
2629
      const validSlotContent = slot && ensureValidVNode(slot(props));
2630
      const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
2631
          ? 64 /* STABLE_FRAGMENT */
2632
          : -2 /* BAIL */);
2633
      isRenderingCompiledSlot--;
2634
      return rendered;
2635
  }
2636
  function ensureValidVNode(vnodes) {
2637
      return vnodes.some(child => {
2638
          if (!isVNode(child))
2639
              return true;
2640
          if (child.type === Comment)
2641
              return false;
2642
          if (child.type === Fragment &&
2643
              !ensureValidVNode(child.children))
2644
              return false;
2645
          return true;
2646
      })
2647
          ? vnodes
2648
          : null;
2649
  }
2650
 
2651
  /**
2652
   * Wrap a slot function to memoize current rendering instance
2653
   * @private
2654
   */
2655
  function withCtx(fn, ctx = currentRenderingInstance) {
2656
      if (!ctx)
2657
          return fn;
2658
      const renderFnWithContext = (...args) => {
2659
          // If a user calls a compiled slot inside a template expression (#1745), it
2660
          // can mess up block tracking, so by default we need to push a null block to
2661
          // avoid that. This isn't necessary if rendering a compiled `<slot>`.
2662
          if (!isRenderingCompiledSlot) {
2663
              openBlock(true /* null block that disables tracking */);
2664
          }
2665
          const owner = currentRenderingInstance;
2666
          setCurrentRenderingInstance(ctx);
2667
          const res = fn(...args);
2668
          setCurrentRenderingInstance(owner);
2669
          if (!isRenderingCompiledSlot) {
2670
              closeBlock();
2671
          }
2672
          return res;
2673
      };
2674
      renderFnWithContext._c = true;
2675
      return renderFnWithContext;
2676
  }
2677
 
2678
  // SFC scoped style ID management.
2679
  let currentScopeId = null;
2680
  const scopeIdStack = [];
2681
  /**
2682
   * @private
2683
   */
2684
  function pushScopeId(id) {
2685
      scopeIdStack.push((currentScopeId = id));
2686
  }
2687
  /**
2688
   * @private
2689
   */
2690
  function popScopeId() {
2691
      scopeIdStack.pop();
2692
      currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null;
2693
  }
2694
  /**
2695
   * @private
2696
   */
2697
  function withScopeId(id) {
2698
      return ((fn) => withCtx(function () {
2699
          pushScopeId(id);
2700
          const res = fn.apply(this, arguments);
2701
          popScopeId();
2702
          return res;
2703
      }));
2704
  }
2705
 
2706
  function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
2707
  isSSR = false) {
2708
      const props = {};
2709
      const attrs = {};
2710
      def(attrs, InternalObjectKey, 1);
2711
      setFullProps(instance, rawProps, props, attrs);
2712
      // validation
2713
      {
2714
          validateProps(props, instance);
2715
      }
2716
      if (isStateful) {
2717
          // stateful
2718
          instance.props = isSSR ? props : shallowReactive(props);
2719
      }
2720
      else {
2721
          if (!instance.type.props) {
2722
              // functional w/ optional props, props === attrs
2723
              instance.props = attrs;
2724
          }
2725
          else {
2726
              // functional w/ declared props
2727
              instance.props = props;
2728
          }
2729
      }
2730
      instance.attrs = attrs;
2731
  }
2732
  function updateProps(instance, rawProps, rawPrevProps, optimized) {
2733
      const { props, attrs, vnode: { patchFlag } } = instance;
2734
      const rawCurrentProps = toRaw(props);
2735
      const [options] = instance.propsOptions;
2736
      if (
2737
      // always force full diff in dev
2738
      // - #1942 if hmr is enabled with sfc component
2739
      // - vite#872 non-sfc component used by sfc component
2740
      !(
2741
          (instance.type.__hmrId ||
2742
              (instance.parent && instance.parent.type.__hmrId))) &&
2743
          (optimized || patchFlag > 0) &&
2744
          !(patchFlag & 16 /* FULL_PROPS */)) {
2745
          if (patchFlag & 8 /* PROPS */) {
2746
              // Compiler-generated props & no keys change, just set the updated
2747
              // the props.
2748
              const propsToUpdate = instance.vnode.dynamicProps;
2749
              for (let i = 0; i < propsToUpdate.length; i++) {
2750
                  const key = propsToUpdate[i];
2751
                  // PROPS flag guarantees rawProps to be non-null
2752
                  const value = rawProps[key];
2753
                  if (options) {
2754
                      // attr / props separation was done on init and will be consistent
2755
                      // in this code path, so just check if attrs have it.
2756
                      if (hasOwn(attrs, key)) {
2757
                          attrs[key] = value;
2758
                      }
2759
                      else {
2760
                          const camelizedKey = camelize(key);
2761
                          props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance);
2762
                      }
2763
                  }
2764
                  else {
2765
                      attrs[key] = value;
2766
                  }
2767
              }
2768
          }
2769
      }
2770
      else {
2771
          // full props update.
2772
          setFullProps(instance, rawProps, props, attrs);
2773
          // in case of dynamic props, check if we need to delete keys from
2774
          // the props object
2775
          let kebabKey;
2776
          for (const key in rawCurrentProps) {
2777
              if (!rawProps ||
2778
                  // for camelCase
2779
                  (!hasOwn(rawProps, key) &&
2780
                      // it's possible the original props was passed in as kebab-case
2781
                      // and converted to camelCase (#955)
2782
                      ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
2783
                  if (options) {
2784
                      if (rawPrevProps &&
2785
                          // for camelCase
2786
                          (rawPrevProps[key] !== undefined ||
2787
                              // for kebab-case
2788
                              rawPrevProps[kebabKey] !== undefined)) {
2789
                          props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance);
2790
                      }
2791
                  }
2792
                  else {
2793
                      delete props[key];
2794
                  }
2795
              }
2796
          }
2797
          // in the case of functional component w/o props declaration, props and
2798
          // attrs point to the same object so it should already have been updated.
2799
          if (attrs !== rawCurrentProps) {
2800
              for (const key in attrs) {
2801
                  if (!rawProps || !hasOwn(rawProps, key)) {
2802
                      delete attrs[key];
2803
                  }
2804
              }
2805
          }
2806
      }
2807
      // trigger updates for $attrs in case it's used in component slots
2808
      trigger(instance, "set" /* SET */, '$attrs');
2809
      if ( rawProps) {
2810
          validateProps(props, instance);
2811
      }
2812
  }
2813
  function setFullProps(instance, rawProps, props, attrs) {
2814
      const [options, needCastKeys] = instance.propsOptions;
2815
      if (rawProps) {
2816
          for (const key in rawProps) {
2817
              const value = rawProps[key];
2818
              // key, ref are reserved and never passed down
2819
              if (isReservedProp(key)) {
2820
                  continue;
2821
              }
2822
              // prop option names are camelized during normalization, so to support
2823
              // kebab -> camel conversion here we need to camelize the key.
2824
              let camelKey;
2825
              if (options && hasOwn(options, (camelKey = camelize(key)))) {
2826
                  props[camelKey] = value;
2827
              }
2828
              else if (!isEmitListener(instance.emitsOptions, key)) {
2829
                  // Any non-declared (either as a prop or an emitted event) props are put
2830
                  // into a separate `attrs` object for spreading. Make sure to preserve
2831
                  // original key casing
2832
                  attrs[key] = value;
2833
              }
2834
          }
2835
      }
2836
      if (needCastKeys) {
2837
          const rawCurrentProps = toRaw(props);
2838
          for (let i = 0; i < needCastKeys.length; i++) {
2839
              const key = needCastKeys[i];
2840
              props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance);
2841
          }
2842
      }
2843
  }
2844
  function resolvePropValue(options, props, key, value, instance) {
2845
      const opt = options[key];
2846
      if (opt != null) {
2847
          const hasDefault = hasOwn(opt, 'default');
2848
          // default values
2849
          if (hasDefault && value === undefined) {
2850
              const defaultValue = opt.default;
2851
              if (opt.type !== Function && isFunction(defaultValue)) {
2852
                  setCurrentInstance(instance);
2853
                  value = defaultValue(props);
2854
                  setCurrentInstance(null);
2855
              }
2856
              else {
2857
                  value = defaultValue;
2858
              }
2859
          }
2860
          // boolean casting
2861
          if (opt[0 /* shouldCast */]) {
2862
              if (!hasOwn(props, key) && !hasDefault) {
2863
                  value = false;
2864
              }
2865
              else if (opt[1 /* shouldCastTrue */] &&
2866
                  (value === '' || value === hyphenate(key))) {
2867
                  value = true;
2868
              }
2869
          }
2870
      }
2871
      return value;
2872
  }
2873
  function normalizePropsOptions(comp, appContext, asMixin = false) {
2874
      if (!appContext.deopt && comp.__props) {
2875
          return comp.__props;
2876
      }
2877
      const raw = comp.props;
2878
      const normalized = {};
2879
      const needCastKeys = [];
2880
      // apply mixin/extends props
2881
      let hasExtends = false;
2882
      if ( !isFunction(comp)) {
2883
          const extendProps = (raw) => {
2884
              hasExtends = true;
2885
              const [props, keys] = normalizePropsOptions(raw, appContext, true);
2886
              extend(normalized, props);
2887
              if (keys)
2888
                  needCastKeys.push(...keys);
2889
          };
2890
          if (!asMixin && appContext.mixins.length) {
2891
              appContext.mixins.forEach(extendProps);
2892
          }
2893
          if (comp.extends) {
2894
              extendProps(comp.extends);
2895
          }
2896
          if (comp.mixins) {
2897
              comp.mixins.forEach(extendProps);
2898
          }
2899
      }
2900
      if (!raw && !hasExtends) {
2901
          return (comp.__props = EMPTY_ARR);
2902
      }
2903
      if (isArray(raw)) {
2904
          for (let i = 0; i < raw.length; i++) {
2905
              if ( !isString(raw[i])) {
2906
                  warn(`props must be strings when using array syntax.`, raw[i]);
2907
              }
2908
              const normalizedKey = camelize(raw[i]);
2909
              if (validatePropName(normalizedKey)) {
2910
                  normalized[normalizedKey] = EMPTY_OBJ;
2911
              }
2912
          }
2913
      }
2914
      else if (raw) {
2915
          if ( !isObject(raw)) {
2916
              warn(`invalid props options`, raw);
2917
          }
2918
          for (const key in raw) {
2919
              const normalizedKey = camelize(key);
2920
              if (validatePropName(normalizedKey)) {
2921
                  const opt = raw[key];
2922
                  const prop = (normalized[normalizedKey] =
2923
                      isArray(opt) || isFunction(opt) ? { type: opt } : opt);
2924
                  if (prop) {
2925
                      const booleanIndex = getTypeIndex(Boolean, prop.type);
2926
                      const stringIndex = getTypeIndex(String, prop.type);
2927
                      prop[0 /* shouldCast */] = booleanIndex > -1;
2928
                      prop[1 /* shouldCastTrue */] =
2929
                          stringIndex < 0 || booleanIndex < stringIndex;
2930
                      // if the prop needs boolean casting or default value
2931
                      if (booleanIndex > -1 || hasOwn(prop, 'default')) {
2932
                          needCastKeys.push(normalizedKey);
2933
                      }
2934
                  }
2935
              }
2936
          }
2937
      }
2938
      return (comp.__props = [normalized, needCastKeys]);
2939
  }
2940
  function validatePropName(key) {
2941
      if (key[0] !== '$') {
2942
          return true;
2943
      }
2944
      else {
2945
          warn(`Invalid prop name: "${key}" is a reserved property.`);
2946
      }
2947
      return false;
2948
  }
2949
  // use function string name to check type constructors
2950
  // so that it works across vms / iframes.
2951
  function getType(ctor) {
2952
      const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
2953
      return match ? match[1] : '';
2954
  }
2955
  function isSameType(a, b) {
2956
      return getType(a) === getType(b);
2957
  }
2958
  function getTypeIndex(type, expectedTypes) {
2959
      if (isArray(expectedTypes)) {
2960
          for (let i = 0, len = expectedTypes.length; i < len; i++) {
2961
              if (isSameType(expectedTypes[i], type)) {
2962
                  return i;
2963
              }
2964
          }
2965
      }
2966
      else if (isFunction(expectedTypes)) {
2967
          return isSameType(expectedTypes, type) ? 0 : -1;
2968
      }
2969
      return -1;
2970
  }
2971
  /**
2972
   * dev only
2973
   */
2974
  function validateProps(props, instance) {
2975
      const rawValues = toRaw(props);
2976
      const options = instance.propsOptions[0];
2977
      for (const key in options) {
2978
          let opt = options[key];
2979
          if (opt == null)
2980
              continue;
2981
          validateProp(key, rawValues[key], opt, !hasOwn(rawValues, key));
2982
      }
2983
  }
2984
  /**
2985
   * dev only
2986
   */
2987
  function validateProp(name, value, prop, isAbsent) {
2988
      const { type, required, validator } = prop;
2989
      // required!
2990
      if (required && isAbsent) {
2991
          warn('Missing required prop: "' + name + '"');
2992
          return;
2993
      }
2994
      // missing but optional
2995
      if (value == null && !prop.required) {
2996
          return;
2997
      }
2998
      // type check
2999
      if (type != null && type !== true) {
3000
          let isValid = false;
3001
          const types = isArray(type) ? type : [type];
3002
          const expectedTypes = [];
3003
          // value is valid as long as one of the specified types match
3004
          for (let i = 0; i < types.length && !isValid; i++) {
3005
              const { valid, expectedType } = assertType(value, types[i]);
3006
              expectedTypes.push(expectedType || '');
3007
              isValid = valid;
3008
          }
3009
          if (!isValid) {
3010
              warn(getInvalidTypeMessage(name, value, expectedTypes));
3011
              return;
3012
          }
3013
      }
3014
      // custom validator
3015
      if (validator && !validator(value)) {
3016
          warn('Invalid prop: custom validator check failed for prop "' + name + '".');
3017
      }
3018
  }
3019
  const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol');
3020
  /**
3021
   * dev only
3022
   */
3023
  function assertType(value, type) {
3024
      let valid;
3025
      const expectedType = getType(type);
3026
      if (isSimpleType(expectedType)) {
3027
          const t = typeof value;
3028
          valid = t === expectedType.toLowerCase();
3029
          // for primitive wrapper objects
3030
          if (!valid && t === 'object') {
3031
              valid = value instanceof type;
3032
          }
3033
      }
3034
      else if (expectedType === 'Object') {
3035
          valid = isObject(value);
3036
      }
3037
      else if (expectedType === 'Array') {
3038
          valid = isArray(value);
3039
      }
3040
      else {
3041
          valid = value instanceof type;
3042
      }
3043
      return {
3044
          valid,
3045
          expectedType
3046
      };
3047
  }
3048
  /**
3049
   * dev only
3050
   */
3051
  function getInvalidTypeMessage(name, value, expectedTypes) {
3052
      let message = `Invalid prop: type check failed for prop "${name}".` +
3053
          ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
3054
      const expectedType = expectedTypes[0];
3055
      const receivedType = toRawType(value);
3056
      const expectedValue = styleValue(value, expectedType);
3057
      const receivedValue = styleValue(value, receivedType);
3058
      // check if we need to specify expected value
3059
      if (expectedTypes.length === 1 &&
3060
          isExplicable(expectedType) &&
3061
          !isBoolean(expectedType, receivedType)) {
3062
          message += ` with value ${expectedValue}`;
3063
      }
3064
      message += `, got ${receivedType} `;
3065
      // check if we need to specify received value
3066
      if (isExplicable(receivedType)) {
3067
          message += `with value ${receivedValue}.`;
3068
      }
3069
      return message;
3070
  }
3071
  /**
3072
   * dev only
3073
   */
3074
  function styleValue(value, type) {
3075
      if (type === 'String') {
3076
          return `"${value}"`;
3077
      }
3078
      else if (type === 'Number') {
3079
          return `${Number(value)}`;
3080
      }
3081
      else {
3082
          return `${value}`;
3083
      }
3084
  }
3085
  /**
3086
   * dev only
3087
   */
3088
  function isExplicable(type) {
3089
      const explicitTypes = ['string', 'number', 'boolean'];
3090
      return explicitTypes.some(elem => type.toLowerCase() === elem);
3091
  }
3092
  /**
3093
   * dev only
3094
   */
3095
  function isBoolean(...args) {
3096
      return args.some(elem => elem.toLowerCase() === 'boolean');
3097
  }
3098
 
3099
  function injectHook(type, hook, target = currentInstance, prepend = false) {
3100
      if (target) {
3101
          const hooks = target[type] || (target[type] = []);
3102
          // cache the error handling wrapper for injected hooks so the same hook
3103
          // can be properly deduped by the scheduler. "__weh" stands for "with error
3104
          // handling".
3105
          const wrappedHook = hook.__weh ||
3106
              (hook.__weh = (...args) => {
3107
                  if (target.isUnmounted) {
3108
                      return;
3109
                  }
3110
                  // disable tracking inside all lifecycle hooks
3111
                  // since they can potentially be called inside effects.
3112
                  pauseTracking();
3113
                  // Set currentInstance during hook invocation.
3114
                  // This assumes the hook does not synchronously trigger other hooks, which
3115
                  // can only be false when the user does something really funky.
3116
                  setCurrentInstance(target);
3117
                  const res = callWithAsyncErrorHandling(hook, target, type, args);
3118
                  setCurrentInstance(null);
3119
                  resetTracking();
3120
                  return res;
3121
              });
3122
          if (prepend) {
3123
              hooks.unshift(wrappedHook);
3124
          }
3125
          else {
3126
              hooks.push(wrappedHook);
3127
          }
3128
          return wrappedHook;
3129
      }
3130
      else {
3131
          const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));
3132
          warn(`${apiName} is called when there is no active component instance to be ` +
3133
              `associated with. ` +
3134
              `Lifecycle injection APIs can only be used during execution of setup().` +
3135
              ( ` If you are using async setup(), make sure to register lifecycle ` +
3136
                      `hooks before the first await statement.`
3137
                  ));
3138
      }
3139
  }
3140
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
3141
  // post-create lifecycle registrations are noops during SSR
3142
  !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
3143
  const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
3144
  const onMounted = createHook("m" /* MOUNTED */);
3145
  const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
3146
  const onUpdated = createHook("u" /* UPDATED */);
3147
  const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
3148
  const onUnmounted = createHook("um" /* UNMOUNTED */);
3149
  const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
3150
  const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
3151
  const onErrorCaptured = (hook, target = currentInstance) => {
3152
      injectHook("ec" /* ERROR_CAPTURED */, hook, target);
3153
  };
3154
 
3155
  // Simple effect.
3156
  function watchEffect(effect, options) {
3157
      return doWatch(effect, null, options);
3158
  }
3159
  // initial value for watchers to trigger on undefined initial values
3160
  const INITIAL_WATCHER_VALUE = {};
3161
  // implementation
3162
  function watch(source, cb, options) {
3163
      if ( !isFunction(cb)) {
3164
          warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
3165
              `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
3166
              `supports \`watch(source, cb, options?) signature.`);
3167
      }
3168
      return doWatch(source, cb, options);
3169
  }
3170
  function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {
3171
      if ( !cb) {
3172
          if (immediate !== undefined) {
3173
              warn(`watch() "immediate" option is only respected when using the ` +
3174
                  `watch(source, callback, options?) signature.`);
3175
          }
3176
          if (deep !== undefined) {
3177
              warn(`watch() "deep" option is only respected when using the ` +
3178
                  `watch(source, callback, options?) signature.`);
3179
          }
3180
      }
3181
      const warnInvalidSource = (s) => {
3182
          warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
3183
              `a reactive object, or an array of these types.`);
3184
      };
3185
      let getter;
3186
      let forceTrigger = false;
3187
      if (isRef(source)) {
3188
          getter = () => source.value;
3189
          forceTrigger = !!source._shallow;
3190
      }
3191
      else if (isReactive(source)) {
3192
          getter = () => source;
3193
          deep = true;
3194
      }
3195
      else if (isArray(source)) {
3196
          getter = () => source.map(s => {
3197
              if (isRef(s)) {
3198
                  return s.value;
3199
              }
3200
              else if (isReactive(s)) {
3201
                  return traverse(s);
3202
              }
3203
              else if (isFunction(s)) {
3204
                  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
3205
              }
3206
              else {
3207
                   warnInvalidSource(s);
3208
              }
3209
          });
3210
      }
3211
      else if (isFunction(source)) {
3212
          if (cb) {
3213
              // getter with cb
3214
              getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
3215
          }
3216
          else {
3217
              // no cb -> simple effect
3218
              getter = () => {
3219
                  if (instance && instance.isUnmounted) {
3220
                      return;
3221
                  }
3222
                  if (cleanup) {
3223
                      cleanup();
3224
                  }
3225
                  return callWithErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onInvalidate]);
3226
              };
3227
          }
3228
      }
3229
      else {
3230
          getter = NOOP;
3231
           warnInvalidSource(source);
3232
      }
3233
      if (cb && deep) {
3234
          const baseGetter = getter;
3235
          getter = () => traverse(baseGetter());
3236
      }
3237
      let cleanup;
3238
      const onInvalidate = (fn) => {
3239
          cleanup = runner.options.onStop = () => {
3240
              callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
3241
          };
3242
      };
3243
      let oldValue = isArray(source) ? [] : INITIAL_WATCHER_VALUE;
3244
      const job = () => {
3245
          if (!runner.active) {
3246
              return;
3247
          }
3248
          if (cb) {
3249
              // watch(source, cb)
3250
              const newValue = runner();
3251
              if (deep || forceTrigger || hasChanged(newValue, oldValue)) {
3252
                  // cleanup before running cb again
3253
                  if (cleanup) {
3254
                      cleanup();
3255
                  }
3256
                  callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
3257
                      newValue,
3258
                      // pass undefined as the old value when it's changed for the first time
3259
                      oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
3260
                      onInvalidate
3261
                  ]);
3262
                  oldValue = newValue;
3263
              }
3264
          }
3265
          else {
3266
              // watchEffect
3267
              runner();
3268
          }
3269
      };
3270
      // important: mark the job as a watcher callback so that scheduler knows
3271
      // it is allowed to self-trigger (#1727)
3272
      job.allowRecurse = !!cb;
3273
      let scheduler;
3274
      if (flush === 'sync') {
3275
          scheduler = job;
3276
      }
3277
      else if (flush === 'post') {
3278
          scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
3279
      }
3280
      else {
3281
          // default: 'pre'
3282
          scheduler = () => {
3283
              if (!instance || instance.isMounted) {
3284
                  queuePreFlushCb(job);
3285
              }
3286
              else {
3287
                  // with 'pre' option, the first call must happen before
3288
                  // the component is mounted so it is called synchronously.
3289
                  job();
3290
              }
3291
          };
3292
      }
3293
      const runner = effect(getter, {
3294
          lazy: true,
3295
          onTrack,
3296
          onTrigger,
3297
          scheduler
3298
      });
3299
      recordInstanceBoundEffect(runner, instance);
3300
      // initial run
3301
      if (cb) {
3302
          if (immediate) {
3303
              job();
3304
          }
3305
          else {
3306
              oldValue = runner();
3307
          }
3308
      }
3309
      else if (flush === 'post') {
3310
          queuePostRenderEffect(runner, instance && instance.suspense);
3311
      }
3312
      else {
3313
          runner();
3314
      }
3315
      return () => {
3316
          stop(runner);
3317
          if (instance) {
3318
              remove(instance.effects, runner);
3319
          }
3320
      };
3321
  }
3322
  // this.$watch
3323
  function instanceWatch(source, cb, options) {
3324
      const publicThis = this.proxy;
3325
      const getter = isString(source)
3326
          ? () => publicThis[source]
3327
          : source.bind(publicThis);
3328
      return doWatch(getter, cb.bind(publicThis), options, this);
3329
  }
3330
  function traverse(value, seen = new Set()) {
3331
      if (!isObject(value) || seen.has(value)) {
3332
          return value;
3333
      }
3334
      seen.add(value);
3335
      if (isRef(value)) {
3336
          traverse(value.value, seen);
3337
      }
3338
      else if (isArray(value)) {
3339
          for (let i = 0; i < value.length; i++) {
3340
              traverse(value[i], seen);
3341
          }
3342
      }
3343
      else if (isSet(value) || isMap(value)) {
3344
          value.forEach((v) => {
3345
              traverse(v, seen);
3346
          });
3347
      }
3348
      else {
3349
          for (const key in value) {
3350
              traverse(value[key], seen);
3351
          }
3352
      }
3353
      return value;
3354
  }
3355
 
3356
  function useTransitionState() {
3357
      const state = {
3358
          isMounted: false,
3359
          isLeaving: false,
3360
          isUnmounting: false,
3361
          leavingVNodes: new Map()
3362
      };
3363
      onMounted(() => {
3364
          state.isMounted = true;
3365
      });
3366
      onBeforeUnmount(() => {
3367
          state.isUnmounting = true;
3368
      });
3369
      return state;
3370
  }
3371
  const TransitionHookValidator = [Function, Array];
3372
  const BaseTransitionImpl = {
3373
      name: `BaseTransition`,
3374
      props: {
3375
          mode: String,
3376
          appear: Boolean,
3377
          persisted: Boolean,
3378
          // enter
3379
          onBeforeEnter: TransitionHookValidator,
3380
          onEnter: TransitionHookValidator,
3381
          onAfterEnter: TransitionHookValidator,
3382
          onEnterCancelled: TransitionHookValidator,
3383
          // leave
3384
          onBeforeLeave: TransitionHookValidator,
3385
          onLeave: TransitionHookValidator,
3386
          onAfterLeave: TransitionHookValidator,
3387
          onLeaveCancelled: TransitionHookValidator,
3388
          // appear
3389
          onBeforeAppear: TransitionHookValidator,
3390
          onAppear: TransitionHookValidator,
3391
          onAfterAppear: TransitionHookValidator,
3392
          onAppearCancelled: TransitionHookValidator
3393
      },
3394
      setup(props, { slots }) {
3395
          const instance = getCurrentInstance();
3396
          const state = useTransitionState();
3397
          let prevTransitionKey;
3398
          return () => {
3399
              const children = slots.default && getTransitionRawChildren(slots.default(), true);
3400
              if (!children || !children.length) {
3401
                  return;
3402
              }
3403
              // warn multiple elements
3404
              if ( children.length > 1) {
3405
                  warn('<transition> can only be used on a single element or component. Use ' +
3406
                      '<transition-group> for lists.');
3407
              }
3408
              // there's no need to track reactivity for these props so use the raw
3409
              // props for a bit better perf
3410
              const rawProps = toRaw(props);
3411
              const { mode } = rawProps;
3412
              // check mode
3413
              if ( mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3414
                  warn(`invalid <transition> mode: ${mode}`);
3415
              }
3416
              // at this point children has a guaranteed length of 1.
3417
              const child = children[0];
3418
              if (state.isLeaving) {
3419
                  return emptyPlaceholder(child);
3420
              }
3421
              // in the case of <transition><keep-alive/></transition>, we need to
3422
              // compare the type of the kept-alive children.
3423
              const innerChild = getKeepAliveChild(child);
3424
              if (!innerChild) {
3425
                  return emptyPlaceholder(child);
3426
              }
3427
              const enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);
3428
              setTransitionHooks(innerChild, enterHooks);
3429
              const oldChild = instance.subTree;
3430
              const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
3431
              let transitionKeyChanged = false;
3432
              const { getTransitionKey } = innerChild.type;
3433
              if (getTransitionKey) {
3434
                  const key = getTransitionKey();
3435
                  if (prevTransitionKey === undefined) {
3436
                      prevTransitionKey = key;
3437
                  }
3438
                  else if (key !== prevTransitionKey) {
3439
                      prevTransitionKey = key;
3440
                      transitionKeyChanged = true;
3441
                  }
3442
              }
3443
              // handle mode
3444
              if (oldInnerChild &&
3445
                  oldInnerChild.type !== Comment &&
3446
                  (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
3447
                  const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
3448
                  // update old tree's hooks in case of dynamic transition
3449
                  setTransitionHooks(oldInnerChild, leavingHooks);
3450
                  // switching between different views
3451
                  if (mode === 'out-in') {
3452
                      state.isLeaving = true;
3453
                      // return placeholder node and queue update when leave finishes
3454
                      leavingHooks.afterLeave = () => {
3455
                          state.isLeaving = false;
3456
                          instance.update();
3457
                      };
3458
                      return emptyPlaceholder(child);
3459
                  }
3460
                  else if (mode === 'in-out') {
3461
                      leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3462
                          const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
3463
                          leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3464
                          // early removal callback
3465
                          el._leaveCb = () => {
3466
                              earlyRemove();
3467
                              el._leaveCb = undefined;
3468
                              delete enterHooks.delayedLeave;
3469
                          };
3470
                          enterHooks.delayedLeave = delayedLeave;
3471
                      };
3472
                  }
3473
              }
3474
              return child;
3475
          };
3476
      }
3477
  };
3478
  // export the public type for h/tsx inference
3479
  // also to avoid inline import() in generated d.ts files
3480
  const BaseTransition = BaseTransitionImpl;
3481
  function getLeavingNodesForType(state, vnode) {
3482
      const { leavingVNodes } = state;
3483
      let leavingVNodesCache = leavingVNodes.get(vnode.type);
3484
      if (!leavingVNodesCache) {
3485
          leavingVNodesCache = Object.create(null);
3486
          leavingVNodes.set(vnode.type, leavingVNodesCache);
3487
      }
3488
      return leavingVNodesCache;
3489
  }
3490
  // The transition hooks are attached to the vnode as vnode.transition
3491
  // and will be called at appropriate timing in the renderer.
3492
  function resolveTransitionHooks(vnode, props, state, instance) {
3493
      const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props;
3494
      const key = String(vnode.key);
3495
      const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3496
      const callHook = (hook, args) => {
3497
          hook &&
3498
              callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
3499
      };
3500
      const hooks = {
3501
          mode,
3502
          persisted,
3503
          beforeEnter(el) {
3504
              let hook = onBeforeEnter;
3505
              if (!state.isMounted) {
3506
                  if (appear) {
3507
                      hook = onBeforeAppear || onBeforeEnter;
3508
                  }
3509
                  else {
3510
                      return;
3511
                  }
3512
              }
3513
              // for same element (v-show)
3514
              if (el._leaveCb) {
3515
                  el._leaveCb(true /* cancelled */);
3516
              }
3517
              // for toggled element with same key (v-if)
3518
              const leavingVNode = leavingVNodesCache[key];
3519
              if (leavingVNode &&
3520
                  isSameVNodeType(vnode, leavingVNode) &&
3521
                  leavingVNode.el._leaveCb) {
3522
                  // force early removal (not cancelled)
3523
                  leavingVNode.el._leaveCb();
3524
              }
3525
              callHook(hook, [el]);
3526
          },
3527
          enter(el) {
3528
              let hook = onEnter;
3529
              let afterHook = onAfterEnter;
3530
              let cancelHook = onEnterCancelled;
3531
              if (!state.isMounted) {
3532
                  if (appear) {
3533
                      hook = onAppear || onEnter;
3534
                      afterHook = onAfterAppear || onAfterEnter;
3535
                      cancelHook = onAppearCancelled || onEnterCancelled;
3536
                  }
3537
                  else {
3538
                      return;
3539
                  }
3540
              }
3541
              let called = false;
3542
              const done = (el._enterCb = (cancelled) => {
3543
                  if (called)
3544
                      return;
3545
                  called = true;
3546
                  if (cancelled) {
3547
                      callHook(cancelHook, [el]);
3548
                  }
3549
                  else {
3550
                      callHook(afterHook, [el]);
3551
                  }
3552
                  if (hooks.delayedLeave) {
3553
                      hooks.delayedLeave();
3554
                  }
3555
                  el._enterCb = undefined;
3556
              });
3557
              if (hook) {
3558
                  hook(el, done);
3559
                  if (hook.length <= 1) {
3560
                      done();
3561
                  }
3562
              }
3563
              else {
3564
                  done();
3565
              }
3566
          },
3567
          leave(el, remove) {
3568
              const key = String(vnode.key);
3569
              if (el._enterCb) {
3570
                  el._enterCb(true /* cancelled */);
3571
              }
3572
              if (state.isUnmounting) {
3573
                  return remove();
3574
              }
3575
              callHook(onBeforeLeave, [el]);
3576
              let called = false;
3577
              const done = (el._leaveCb = (cancelled) => {
3578
                  if (called)
3579
                      return;
3580
                  called = true;
3581
                  remove();
3582
                  if (cancelled) {
3583
                      callHook(onLeaveCancelled, [el]);
3584
                  }
3585
                  else {
3586
                      callHook(onAfterLeave, [el]);
3587
                  }
3588
                  el._leaveCb = undefined;
3589
                  if (leavingVNodesCache[key] === vnode) {
3590
                      delete leavingVNodesCache[key];
3591
                  }
3592
              });
3593
              leavingVNodesCache[key] = vnode;
3594
              if (onLeave) {
3595
                  onLeave(el, done);
3596
                  if (onLeave.length <= 1) {
3597
                      done();
3598
                  }
3599
              }
3600
              else {
3601
                  done();
3602
              }
3603
          },
3604
          clone(vnode) {
3605
              return resolveTransitionHooks(vnode, props, state, instance);
3606
          }
3607
      };
3608
      return hooks;
3609
  }
3610
  // the placeholder really only handles one special case: KeepAlive
3611
  // in the case of a KeepAlive in a leave phase we need to return a KeepAlive
3612
  // placeholder with empty content to avoid the KeepAlive instance from being
3613
  // unmounted.
3614
  function emptyPlaceholder(vnode) {
3615
      if (isKeepAlive(vnode)) {
3616
          vnode = cloneVNode(vnode);
3617
          vnode.children = null;
3618
          return vnode;
3619
      }
3620
  }
3621
  function getKeepAliveChild(vnode) {
3622
      return isKeepAlive(vnode)
3623
          ? vnode.children
3624
              ? vnode.children[0]
3625
              : undefined
3626
          : vnode;
3627
  }
3628
  function setTransitionHooks(vnode, hooks) {
3629
      if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
3630
          setTransitionHooks(vnode.component.subTree, hooks);
3631
      }
3632
      else if ( vnode.shapeFlag & 128 /* SUSPENSE */) {
3633
          vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3634
          vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3635
      }
3636
      else {
3637
          vnode.transition = hooks;
3638
      }
3639
  }
3640
  function getTransitionRawChildren(children, keepComment = false) {
3641
      let ret = [];
3642
      let keyedFragmentCount = 0;
3643
      for (let i = 0; i < children.length; i++) {
3644
          const child = children[i];
3645
          // handle fragment children case, e.g. v-for
3646
          if (child.type === Fragment) {
3647
              if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
3648
                  keyedFragmentCount++;
3649
              ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
3650
          }
3651
          // comment placeholders should be skipped, e.g. v-if
3652
          else if (keepComment || child.type !== Comment) {
3653
              ret.push(child);
3654
          }
3655
      }
3656
      // #1126 if a transition children list contains multiple sub fragments, these
3657
      // fragments will be merged into a flat children array. Since each v-for
3658
      // fragment may contain different static bindings inside, we need to de-op
3659
      // these children to force full diffs to ensure correct behavior.
3660
      if (keyedFragmentCount > 1) {
3661
          for (let i = 0; i < ret.length; i++) {
3662
              ret[i].patchFlag = -2 /* BAIL */;
3663
          }
3664
      }
3665
      return ret;
3666
  }
3667
 
3668
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
3669
  const KeepAliveImpl = {
3670
      name: `KeepAlive`,
3671
      // Marker for special handling inside the renderer. We are not using a ===
3672
      // check directly on KeepAlive in the renderer, because importing it directly
3673
      // would prevent it from being tree-shaken.
3674
      __isKeepAlive: true,
3675
      inheritRef: true,
3676
      props: {
3677
          include: [String, RegExp, Array],
3678
          exclude: [String, RegExp, Array],
3679
          max: [String, Number]
3680
      },
3681
      setup(props, { slots }) {
3682
          const cache = new Map();
3683
          const keys = new Set();
3684
          let current = null;
3685
          const instance = getCurrentInstance();
3686
          const parentSuspense = instance.suspense;
3687
          // KeepAlive communicates with the instantiated renderer via the
3688
          // ctx where the renderer passes in its internals,
3689
          // and the KeepAlive instance exposes activate/deactivate implementations.
3690
          // The whole point of this is to avoid importing KeepAlive directly in the
3691
          // renderer to facilitate tree-shaking.
3692
          const sharedContext = instance.ctx;
3693
          const { renderer: { p: patch, m: move, um: _unmount, o: { createElement } } } = sharedContext;
3694
          const storageContainer = createElement('div');
3695
          sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
3696
              const instance = vnode.component;
3697
              move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
3698
              // in case props have changed
3699
              patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, optimized);
3700
              queuePostRenderEffect(() => {
3701
                  instance.isDeactivated = false;
3702
                  if (instance.a) {
3703
                      invokeArrayFns(instance.a);
3704
                  }
3705
                  const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
3706
                  if (vnodeHook) {
3707
                      invokeVNodeHook(vnodeHook, instance.parent, vnode);
3708
                  }
3709
              }, parentSuspense);
3710
          };
3711
          sharedContext.deactivate = (vnode) => {
3712
              const instance = vnode.component;
3713
              move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
3714
              queuePostRenderEffect(() => {
3715
                  if (instance.da) {
3716
                      invokeArrayFns(instance.da);
3717
                  }
3718
                  const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
3719
                  if (vnodeHook) {
3720
                      invokeVNodeHook(vnodeHook, instance.parent, vnode);
3721
                  }
3722
                  instance.isDeactivated = true;
3723
              }, parentSuspense);
3724
          };
3725
          function unmount(vnode) {
3726
              // reset the shapeFlag so it can be properly unmounted
3727
              resetShapeFlag(vnode);
3728
              _unmount(vnode, instance, parentSuspense);
3729
          }
3730
          function pruneCache(filter) {
3731
              cache.forEach((vnode, key) => {
3732
                  const name = getComponentName(vnode.type);
3733
                  if (name && (!filter || !filter(name))) {
3734
                      pruneCacheEntry(key);
3735
                  }
3736
              });
3737
          }
3738
          function pruneCacheEntry(key) {
3739
              const cached = cache.get(key);
3740
              if (!current || cached.type !== current.type) {
3741
                  unmount(cached);
3742
              }
3743
              else if (current) {
3744
                  // current active instance should no longer be kept-alive.
3745
                  // we can't unmount it now but it might be later, so reset its flag now.
3746
                  resetShapeFlag(current);
3747
              }
3748
              cache.delete(key);
3749
              keys.delete(key);
3750
          }
3751
          // prune cache on include/exclude prop change
3752
          watch(() => [props.include, props.exclude], ([include, exclude]) => {
3753
              include && pruneCache(name => matches(include, name));
3754
              exclude && pruneCache(name => !matches(exclude, name));
3755
          },
3756
          // prune post-render after `current` has been updated
3757
          { flush: 'post', deep: true });
3758
          // cache sub tree after render
3759
          let pendingCacheKey = null;
3760
          const cacheSubtree = () => {
3761
              // fix #1621, the pendingCacheKey could be 0
3762
              if (pendingCacheKey != null) {
3763
                  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
3764
              }
3765
          };
3766
          onMounted(cacheSubtree);
3767
          onUpdated(cacheSubtree);
3768
          onBeforeUnmount(() => {
3769
              cache.forEach(cached => {
3770
                  const { subTree, suspense } = instance;
3771
                  const vnode = getInnerChild(subTree);
3772
                  if (cached.type === vnode.type) {
3773
                      // current instance will be unmounted as part of keep-alive's unmount
3774
                      resetShapeFlag(vnode);
3775
                      // but invoke its deactivated hook here
3776
                      const da = vnode.component.da;
3777
                      da && queuePostRenderEffect(da, suspense);
3778
                      return;
3779
                  }
3780
                  unmount(cached);
3781
              });
3782
          });
3783
          return () => {
3784
              pendingCacheKey = null;
3785
              if (!slots.default) {
3786
                  return null;
3787
              }
3788
              const children = slots.default();
3789
              const rawVNode = children[0];
3790
              if (children.length > 1) {
3791
                  {
3792
                      warn(`KeepAlive should contain exactly one component child.`);
3793
                  }
3794
                  current = null;
3795
                  return children;
3796
              }
3797
              else if (!isVNode(rawVNode) ||
3798
                  (!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
3799
                      !(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
3800
                  current = null;
3801
                  return rawVNode;
3802
              }
3803
              let vnode = getInnerChild(rawVNode);
3804
              const comp = vnode.type;
3805
              const name = getComponentName(comp);
3806
              const { include, exclude, max } = props;
3807
              if ((include && (!name || !matches(include, name))) ||
3808
                  (exclude && name && matches(exclude, name))) {
3809
                  current = vnode;
3810
                  return rawVNode;
3811
              }
3812
              const key = vnode.key == null ? comp : vnode.key;
3813
              const cachedVNode = cache.get(key);
3814
              // clone vnode if it's reused because we are going to mutate it
3815
              if (vnode.el) {
3816
                  vnode = cloneVNode(vnode);
3817
                  if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
3818
                      rawVNode.ssContent = vnode;
3819
                  }
3820
              }
3821
              // #1513 it's possible for the returned vnode to be cloned due to attr
3822
              // fallthrough or scopeId, so the vnode here may not be the final vnode
3823
              // that is mounted. Instead of caching it directly, we store the pending
3824
              // key and cache `instance.subTree` (the normalized vnode) in
3825
              // beforeMount/beforeUpdate hooks.
3826
              pendingCacheKey = key;
3827
              if (cachedVNode) {
3828
                  // copy over mounted state
3829
                  vnode.el = cachedVNode.el;
3830
                  vnode.component = cachedVNode.component;
3831
                  if (vnode.transition) {
3832
                      // recursively update transition hooks on subTree
3833
                      setTransitionHooks(vnode, vnode.transition);
3834
                  }
3835
                  // avoid vnode being mounted as fresh
3836
                  vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
3837
                  // make this key the freshest
3838
                  keys.delete(key);
3839
                  keys.add(key);
3840
              }
3841
              else {
3842
                  keys.add(key);
3843
                  // prune oldest entry
3844
                  if (max && keys.size > parseInt(max, 10)) {
3845
                      pruneCacheEntry(keys.values().next().value);
3846
                  }
3847
              }
3848
              // avoid vnode being unmounted
3849
              vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
3850
              current = vnode;
3851
              return rawVNode;
3852
          };
3853
      }
3854
  };
3855
  // export the public type for h/tsx inference
3856
  // also to avoid inline import() in generated d.ts files
3857
  const KeepAlive = KeepAliveImpl;
3858
  function matches(pattern, name) {
3859
      if (isArray(pattern)) {
3860
          return pattern.some((p) => matches(p, name));
3861
      }
3862
      else if (isString(pattern)) {
3863
          return pattern.split(',').indexOf(name) > -1;
3864
      }
3865
      else if (pattern.test) {
3866
          return pattern.test(name);
3867
      }
3868
      /* istanbul ignore next */
3869
      return false;
3870
  }
3871
  function onActivated(hook, target) {
3872
      registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
3873
  }
3874
  function onDeactivated(hook, target) {
3875
      registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
3876
  }
3877
  function registerKeepAliveHook(hook, type, target = currentInstance) {
3878
      // cache the deactivate branch check wrapper for injected hooks so the same
3879
      // hook can be properly deduped by the scheduler. "__wdc" stands for "with
3880
      // deactivation check".
3881
      const wrappedHook = hook.__wdc ||
3882
          (hook.__wdc = () => {
3883
              // only fire the hook if the target instance is NOT in a deactivated branch.
3884
              let current = target;
3885
              while (current) {
3886
                  if (current.isDeactivated) {
3887
                      return;
3888
                  }
3889
                  current = current.parent;
3890
              }
3891
              hook();
3892
          });
3893
      injectHook(type, wrappedHook, target);
3894
      // In addition to registering it on the target instance, we walk up the parent
3895
      // chain and register it on all ancestor instances that are keep-alive roots.
3896
      // This avoids the need to walk the entire component tree when invoking these
3897
      // hooks, and more importantly, avoids the need to track child components in
3898
      // arrays.
3899
      if (target) {
3900
          let current = target.parent;
3901
          while (current && current.parent) {
3902
              if (isKeepAlive(current.parent.vnode)) {
3903
                  injectToKeepAliveRoot(wrappedHook, type, target, current);
3904
              }
3905
              current = current.parent;
3906
          }
3907
      }
3908
  }
3909
  function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
3910
      // injectHook wraps the original for error handling, so make sure to remove
3911
      // the wrapped version.
3912
      const injected = injectHook(type, hook, keepAliveRoot, true /* prepend */);
3913
      onUnmounted(() => {
3914
          remove(keepAliveRoot[type], injected);
3915
      }, target);
3916
  }
3917
  function resetShapeFlag(vnode) {
3918
      let shapeFlag = vnode.shapeFlag;
3919
      if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
3920
          shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
3921
      }
3922
      if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
3923
          shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
3924
      }
3925
      vnode.shapeFlag = shapeFlag;
3926
  }
3927
  function getInnerChild(vnode) {
3928
      return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
3929
  }
3930
 
3931
  const isInternalKey = (key) => key[0] === '_' || key === '$stable';
3932
  const normalizeSlotValue = (value) => isArray(value)
3933
      ? value.map(normalizeVNode)
3934
      : [normalizeVNode(value)];
3935
  const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => {
3936
      if ( currentInstance) {
3937
          warn(`Slot "${key}" invoked outside of the render function: ` +
3938
              `this will not track dependencies used in the slot. ` +
3939
              `Invoke the slot function inside the render function instead.`);
3940
      }
3941
      return normalizeSlotValue(rawSlot(props));
3942
  }, ctx);
3943
  const normalizeObjectSlots = (rawSlots, slots) => {
3944
      const ctx = rawSlots._ctx;
3945
      for (const key in rawSlots) {
3946
          if (isInternalKey(key))
3947
              continue;
3948
          const value = rawSlots[key];
3949
          if (isFunction(value)) {
3950
              slots[key] = normalizeSlot(key, value, ctx);
3951
          }
3952
          else if (value != null) {
3953
              {
3954
                  warn(`Non-function value encountered for slot "${key}". ` +
3955
                      `Prefer function slots for better performance.`);
3956
              }
3957
              const normalized = normalizeSlotValue(value);
3958
              slots[key] = () => normalized;
3959
          }
3960
      }
3961
  };
3962
  const normalizeVNodeSlots = (instance, children) => {
3963
      if ( !isKeepAlive(instance.vnode)) {
3964
          warn(`Non-function value encountered for default slot. ` +
3965
              `Prefer function slots for better performance.`);
3966
      }
3967
      const normalized = normalizeSlotValue(children);
3968
      instance.slots.default = () => normalized;
3969
  };
3970
  const initSlots = (instance, children) => {
3971
      if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3972
          const type = children._;
3973
          if (type) {
3974
              instance.slots = children;
3975
              // make compiler marker non-enumerable
3976
              def(children, '_', type);
3977
          }
3978
          else {
3979
              normalizeObjectSlots(children, (instance.slots = {}));
3980
          }
3981
      }
3982
      else {
3983
          instance.slots = {};
3984
          if (children) {
3985
              normalizeVNodeSlots(instance, children);
3986
          }
3987
      }
3988
      def(instance.slots, InternalObjectKey, 1);
3989
  };
3990
  const updateSlots = (instance, children) => {
3991
      const { vnode, slots } = instance;
3992
      let needDeletionCheck = true;
3993
      let deletionComparisonTarget = EMPTY_OBJ;
3994
      if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3995
          const type = children._;
3996
          if (type) {
3997
              // compiled slots.
3998
              if ( isHmrUpdating) {
3999
                  // Parent was HMR updated so slot content may have changed.
4000
                  // force update slots and mark instance for hmr as well
4001
                  extend(slots, children);
4002
              }
4003
              else if (type === 1 /* STABLE */) {
4004
                  // compiled AND stable.
4005
                  // no need to update, and skip stale slots removal.
4006
                  needDeletionCheck = false;
4007
              }
4008
              else {
4009
                  // compiled but dynamic (v-if/v-for on slots) - update slots, but skip
4010
                  // normalization.
4011
                  extend(slots, children);
4012
              }
4013
          }
4014
          else {
4015
              needDeletionCheck = !children.$stable;
4016
              normalizeObjectSlots(children, slots);
4017
          }
4018
          deletionComparisonTarget = children;
4019
      }
4020
      else if (children) {
4021
          // non slot object children (direct value) passed to a component
4022
          normalizeVNodeSlots(instance, children);
4023
          deletionComparisonTarget = { default: 1 };
4024
      }
4025
      // delete stale slots
4026
      if (needDeletionCheck) {
4027
          for (const key in slots) {
4028
              if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
4029
                  delete slots[key];
4030
              }
4031
          }
4032
      }
4033
  };
4034
 
4035
  /**
4036
  Runtime helper for applying directives to a vnode. Example usage:
4037
 
4038
  const comp = resolveComponent('comp')
4039
  const foo = resolveDirective('foo')
4040
  const bar = resolveDirective('bar')
4041
 
4042
  return withDirectives(h(comp), [
4043
    [foo, this.x],
4044
    [bar, this.y]
4045
  ])
4046
  */
4047
  const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4048
  function validateDirectiveName(name) {
4049
      if (isBuiltInDirective(name)) {
4050
          warn('Do not use built-in directive ids as custom directive id: ' + name);
4051
      }
4052
  }
4053
  /**
4054
   * Adds directives to a VNode.
4055
   */
4056
  function withDirectives(vnode, directives) {
4057
      const internalInstance = currentRenderingInstance;
4058
      if (internalInstance === null) {
4059
           warn(`withDirectives can only be used inside render functions.`);
4060
          return vnode;
4061
      }
4062
      const instance = internalInstance.proxy;
4063
      const bindings = vnode.dirs || (vnode.dirs = []);
4064
      for (let i = 0; i < directives.length; i++) {
4065
          let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4066
          if (isFunction(dir)) {
4067
              dir = {
4068
                  mounted: dir,
4069
                  updated: dir
4070
              };
4071
          }
4072
          bindings.push({
4073
              dir,
4074
              instance,
4075
              value,
4076
              oldValue: void 0,
4077
              arg,
4078
              modifiers
4079
          });
4080
      }
4081
      return vnode;
4082
  }
4083
  function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4084
      const bindings = vnode.dirs;
4085
      const oldBindings = prevVNode && prevVNode.dirs;
4086
      for (let i = 0; i < bindings.length; i++) {
4087
          const binding = bindings[i];
4088
          if (oldBindings) {
4089
              binding.oldValue = oldBindings[i].value;
4090
          }
4091
          const hook = binding.dir[name];
4092
          if (hook) {
4093
              callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
4094
                  vnode.el,
4095
                  binding,
4096
                  vnode,
4097
                  prevVNode
4098
              ]);
4099
          }
4100
      }
4101
  }
4102
 
4103
  function createAppContext() {
4104
      return {
4105
          app: null,
4106
          config: {
4107
              isNativeTag: NO,
4108
              performance: false,
4109
              globalProperties: {},
4110
              optionMergeStrategies: {},
4111
              isCustomElement: NO,
4112
              errorHandler: undefined,
4113
              warnHandler: undefined
4114
          },
4115
          mixins: [],
4116
          components: {},
4117
          directives: {},
4118
          provides: Object.create(null)
4119
      };
4120
  }
4121
  let uid$1 = 0;
4122
  function createAppAPI(render, hydrate) {
4123
      return function createApp(rootComponent, rootProps = null) {
4124
          if (rootProps != null && !isObject(rootProps)) {
4125
               warn(`root props passed to app.mount() must be an object.`);
4126
              rootProps = null;
4127
          }
4128
          const context = createAppContext();
4129
          const installedPlugins = new Set();
4130
          let isMounted = false;
4131
          const app = (context.app = {
4132
              _uid: uid$1++,
4133
              _component: rootComponent,
4134
              _props: rootProps,
4135
              _container: null,
4136
              _context: context,
4137
              version,
4138
              get config() {
4139
                  return context.config;
4140
              },
4141
              set config(v) {
4142
                  {
4143
                      warn(`app.config cannot be replaced. Modify individual options instead.`);
4144
                  }
4145
              },
4146
              use(plugin, ...options) {
4147
                  if (installedPlugins.has(plugin)) {
4148
                       warn(`Plugin has already been applied to target app.`);
4149
                  }
4150
                  else if (plugin && isFunction(plugin.install)) {
4151
                      installedPlugins.add(plugin);
4152
                      plugin.install(app, ...options);
4153
                  }
4154
                  else if (isFunction(plugin)) {
4155
                      installedPlugins.add(plugin);
4156
                      plugin(app, ...options);
4157
                  }
4158
                  else {
4159
                      warn(`A plugin must either be a function or an object with an "install" ` +
4160
                          `function.`);
4161
                  }
4162
                  return app;
4163
              },
4164
              mixin(mixin) {
4165
                  {
4166
                      if (!context.mixins.includes(mixin)) {
4167
                          context.mixins.push(mixin);
4168
                          // global mixin with props/emits de-optimizes props/emits
4169
                          // normalization caching.
4170
                          if (mixin.props || mixin.emits) {
4171
                              context.deopt = true;
4172
                          }
4173
                      }
4174
                      else {
4175
                          warn('Mixin has already been applied to target app' +
4176
                              (mixin.name ? `: ${mixin.name}` : ''));
4177
                      }
4178
                  }
4179
                  return app;
4180
              },
4181
              component(name, component) {
4182
                  {
4183
                      validateComponentName(name, context.config);
4184
                  }
4185
                  if (!component) {
4186
                      return context.components[name];
4187
                  }
4188
                  if ( context.components[name]) {
4189
                      warn(`Component "${name}" has already been registered in target app.`);
4190
                  }
4191
                  context.components[name] = component;
4192
                  return app;
4193
              },
4194
              directive(name, directive) {
4195
                  {
4196
                      validateDirectiveName(name);
4197
                  }
4198
                  if (!directive) {
4199
                      return context.directives[name];
4200
                  }
4201
                  if ( context.directives[name]) {
4202
                      warn(`Directive "${name}" has already been registered in target app.`);
4203
                  }
4204
                  context.directives[name] = directive;
4205
                  return app;
4206
              },
4207
              mount(rootContainer, isHydrate) {
4208
                  if (!isMounted) {
4209
                      const vnode = createVNode(rootComponent, rootProps);
4210
                      // store app context on the root VNode.
4211
                      // this will be set on the root instance on initial mount.
4212
                      vnode.appContext = context;
4213
                      // HMR root reload
4214
                      {
4215
                          context.reload = () => {
4216
                              render(cloneVNode(vnode), rootContainer);
4217
                          };
4218
                      }
4219
                      if (isHydrate && hydrate) {
4220
                          hydrate(vnode, rootContainer);
4221
                      }
4222
                      else {
4223
                          render(vnode, rootContainer);
4224
                      }
4225
                      isMounted = true;
4226
                      app._container = rootContainer;
4227
                      rootContainer.__vue_app__ = app;
4228
                      {
4229
                          devtoolsInitApp(app, version);
4230
                      }
4231
                      return vnode.component.proxy;
4232
                  }
4233
                  else {
4234
                      warn(`App has already been mounted.\n` +
4235
                          `If you want to remount the same app, move your app creation logic ` +
4236
                          `into a factory function and create fresh app instances for each ` +
4237
                          `mount - e.g. \`const createMyApp = () => createApp(App)\``);
4238
                  }
4239
              },
4240
              unmount() {
4241
                  if (isMounted) {
4242
                      render(null, app._container);
4243
                      {
4244
                          devtoolsUnmountApp(app);
4245
                      }
4246
                  }
4247
                  else {
4248
                      warn(`Cannot unmount an app that is not mounted.`);
4249
                  }
4250
              },
4251
              provide(key, value) {
4252
                  if ( key in context.provides) {
4253
                      warn(`App already provides property with key "${String(key)}". ` +
4254
                          `It will be overwritten with the new value.`);
4255
                  }
4256
                  // TypeScript doesn't allow symbols as index type
4257
                  // https://github.com/Microsoft/TypeScript/issues/24587
4258
                  context.provides[key] = value;
4259
                  return app;
4260
              }
4261
          });
4262
          return app;
4263
      };
4264
  }
4265
 
4266
  let hasMismatch = false;
4267
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
4268
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4269
  // Note: hydration is DOM-specific
4270
  // But we have to place it in core due to tight coupling with core - splitting
4271
  // it out creates a ton of unnecessary complexity.
4272
  // Hydration also depends on some renderer internal logic which needs to be
4273
  // passed in via arguments.
4274
  function createHydrationFunctions(rendererInternals) {
4275
      const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4276
      const hydrate = (vnode, container) => {
4277
          if ( !container.hasChildNodes()) {
4278
              warn(`Attempting to hydrate existing markup but container is empty. ` +
4279
                  `Performing full mount instead.`);
4280
              patch(null, vnode, container);
4281
              return;
4282
          }
4283
          hasMismatch = false;
4284
          hydrateNode(container.firstChild, vnode, null, null);
4285
          flushPostFlushCbs();
4286
          if (hasMismatch && !false) {
4287
              // this error should show up in production
4288
              console.error(`Hydration completed but contains mismatches.`);
4289
          }
4290
      };
4291
      const hydrateNode = (node, vnode, parentComponent, parentSuspense, optimized = false) => {
4292
          const isFragmentStart = isComment(node) && node.data === '[';
4293
          const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, isFragmentStart);
4294
          const { type, ref, shapeFlag } = vnode;
4295
          const domType = node.nodeType;
4296
          vnode.el = node;
4297
          let nextNode = null;
4298
          switch (type) {
4299
              case Text:
4300
                  if (domType !== 3 /* TEXT */) {
4301
                      nextNode = onMismatch();
4302
                  }
4303
                  else {
4304
                      if (node.data !== vnode.children) {
4305
                          hasMismatch = true;
4306
 
4307
                              warn(`Hydration text mismatch:` +
4308
                                  `\n- Client: ${JSON.stringify(node.data)}` +
4309
                                  `\n- Server: ${JSON.stringify(vnode.children)}`);
4310
                          node.data = vnode.children;
4311
                      }
4312
                      nextNode = nextSibling(node);
4313
                  }
4314
                  break;
4315
              case Comment:
4316
                  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
4317
                      nextNode = onMismatch();
4318
                  }
4319
                  else {
4320
                      nextNode = nextSibling(node);
4321
                  }
4322
                  break;
4323
              case Static:
4324
                  if (domType !== 1 /* ELEMENT */) {
4325
                      nextNode = onMismatch();
4326
                  }
4327
                  else {
4328
                      // determine anchor, adopt content
4329
                      nextNode = node;
4330
                      // if the static vnode has its content stripped during build,
4331
                      // adopt it from the server-rendered HTML.
4332
                      const needToAdoptContent = !vnode.children.length;
4333
                      for (let i = 0; i < vnode.staticCount; i++) {
4334
                          if (needToAdoptContent)
4335
                              vnode.children += nextNode.outerHTML;
4336
                          if (i === vnode.staticCount - 1) {
4337
                              vnode.anchor = nextNode;
4338
                          }
4339
                          nextNode = nextSibling(nextNode);
4340
                      }
4341
                      return nextNode;
4342
                  }
4343
                  break;
4344
              case Fragment:
4345
                  if (!isFragmentStart) {
4346
                      nextNode = onMismatch();
4347
                  }
4348
                  else {
4349
                      nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, optimized);
4350
                  }
4351
                  break;
4352
              default:
4353
                  if (shapeFlag & 1 /* ELEMENT */) {
4354
                      if (domType !== 1 /* ELEMENT */ ||
4355
                          vnode.type !== node.tagName.toLowerCase()) {
4356
                          nextNode = onMismatch();
4357
                      }
4358
                      else {
4359
                          nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, optimized);
4360
                      }
4361
                  }
4362
                  else if (shapeFlag & 6 /* COMPONENT */) {
4363
                      // when setting up the render effect, if the initial vnode already
4364
                      // has .el set, the component will perform hydration instead of mount
4365
                      // on its sub-tree.
4366
                      const container = parentNode(node);
4367
                      const hydrateComponent = () => {
4368
                          mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);
4369
                      };
4370
                      // async component
4371
                      const loadAsync = vnode.type.__asyncLoader;
4372
                      if (loadAsync) {
4373
                          loadAsync().then(hydrateComponent);
4374
                      }
4375
                      else {
4376
                          hydrateComponent();
4377
                      }
4378
                      // component may be async, so in the case of fragments we cannot rely
4379
                      // on component's rendered output to determine the end of the fragment
4380
                      // instead, we do a lookahead to find the end anchor node.
4381
                      nextNode = isFragmentStart
4382
                          ? locateClosingAsyncAnchor(node)
4383
                          : nextSibling(node);
4384
                  }
4385
                  else if (shapeFlag & 64 /* TELEPORT */) {
4386
                      if (domType !== 8 /* COMMENT */) {
4387
                          nextNode = onMismatch();
4388
                      }
4389
                      else {
4390
                          nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, optimized, rendererInternals, hydrateChildren);
4391
                      }
4392
                  }
4393
                  else if ( shapeFlag & 128 /* SUSPENSE */) {
4394
                      nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), optimized, rendererInternals, hydrateNode);
4395
                  }
4396
                  else {
4397
                      warn('Invalid HostVNode type:', type, `(${typeof type})`);
4398
                  }
4399
          }
4400
          if (ref != null) {
4401
              setRef(ref, null, parentSuspense, vnode);
4402
          }
4403
          return nextNode;
4404
      };
4405
      const hydrateElement = (el, vnode, parentComponent, parentSuspense, optimized) => {
4406
          optimized = optimized || !!vnode.dynamicChildren;
4407
          const { props, patchFlag, shapeFlag, dirs } = vnode;
4408
          // skip props & children if this is hoisted static nodes
4409
          if (patchFlag !== -1 /* HOISTED */) {
4410
              if (dirs) {
4411
                  invokeDirectiveHook(vnode, null, parentComponent, 'created');
4412
              }
4413
              // props
4414
              if (props) {
4415
                  if (!optimized ||
4416
                      (patchFlag & 16 /* FULL_PROPS */ ||
4417
                          patchFlag & 32 /* HYDRATE_EVENTS */)) {
4418
                      for (const key in props) {
4419
                          if (!isReservedProp(key) && isOn(key)) {
4420
                              patchProp(el, key, null, props[key]);
4421
                          }
4422
                      }
4423
                  }
4424
                  else if (props.onClick) {
4425
                      // Fast path for click listeners (which is most often) to avoid
4426
                      // iterating through props.
4427
                      patchProp(el, 'onClick', null, props.onClick);
4428
                  }
4429
              }
4430
              // vnode / directive hooks
4431
              let vnodeHooks;
4432
              if ((vnodeHooks = props && props.onVnodeBeforeMount)) {
4433
                  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4434
              }
4435
              if (dirs) {
4436
                  invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
4437
              }
4438
              if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
4439
                  queueEffectWithSuspense(() => {
4440
                      vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4441
                      dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
4442
                  }, parentSuspense);
4443
              }
4444
              // children
4445
              if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
4446
                  // skip if element has innerHTML / textContent
4447
                  !(props && (props.innerHTML || props.textContent))) {
4448
                  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, optimized);
4449
                  let hasWarned = false;
4450
                  while (next) {
4451
                      hasMismatch = true;
4452
                      if ( !hasWarned) {
4453
                          warn(`Hydration children mismatch in <${vnode.type}>: ` +
4454
                              `server rendered element contains more child nodes than client vdom.`);
4455
                          hasWarned = true;
4456
                      }
4457
                      // The SSRed DOM contains more nodes than it should. Remove them.
4458
                      const cur = next;
4459
                      next = next.nextSibling;
4460
                      remove(cur);
4461
                  }
4462
              }
4463
              else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4464
                  if (el.textContent !== vnode.children) {
4465
                      hasMismatch = true;
4466
 
4467
                          warn(`Hydration text content mismatch in <${vnode.type}>:\n` +
4468
                              `- Client: ${el.textContent}\n` +
4469
                              `- Server: ${vnode.children}`);
4470
                      el.textContent = vnode.children;
4471
                  }
4472
              }
4473
          }
4474
          return el.nextSibling;
4475
      };
4476
      const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, optimized) => {
4477
          optimized = optimized || !!parentVNode.dynamicChildren;
4478
          const children = parentVNode.children;
4479
          const l = children.length;
4480
          let hasWarned = false;
4481
          for (let i = 0; i < l; i++) {
4482
              const vnode = optimized
4483
                  ? children[i]
4484
                  : (children[i] = normalizeVNode(children[i]));
4485
              if (node) {
4486
                  node = hydrateNode(node, vnode, parentComponent, parentSuspense, optimized);
4487
              }
4488
              else {
4489
                  hasMismatch = true;
4490
                  if ( !hasWarned) {
4491
                      warn(`Hydration children mismatch in <${container.tagName.toLowerCase()}>: ` +
4492
                          `server rendered element contains fewer child nodes than client vdom.`);
4493
                      hasWarned = true;
4494
                  }
4495
                  // the SSRed DOM didn't contain enough nodes. Mount the missing ones.
4496
                  patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container));
4497
              }
4498
          }
4499
          return node;
4500
      };
4501
      const hydrateFragment = (node, vnode, parentComponent, parentSuspense, optimized) => {
4502
          const container = parentNode(node);
4503
          const next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, optimized);
4504
          if (next && isComment(next) && next.data === ']') {
4505
              return nextSibling((vnode.anchor = next));
4506
          }
4507
          else {
4508
              // fragment didn't hydrate successfully, since we didn't get a end anchor
4509
              // back. This should have led to node/children mismatch warnings.
4510
              hasMismatch = true;
4511
              // since the anchor is missing, we need to create one and insert it
4512
              insert((vnode.anchor = createComment(`]`)), container, next);
4513
              return next;
4514
          }
4515
      };
4516
      const handleMismatch = (node, vnode, parentComponent, parentSuspense, isFragment) => {
4517
          hasMismatch = true;
4518
 
4519
              warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
4520
                  ? `(text)`
4521
                  : isComment(node) && node.data === '['
4522
                      ? `(start of fragment)`
4523
                      : ``);
4524
          vnode.el = null;
4525
          if (isFragment) {
4526
              // remove excessive fragment nodes
4527
              const end = locateClosingAsyncAnchor(node);
4528
              while (true) {
4529
                  const next = nextSibling(node);
4530
                  if (next && next !== end) {
4531
                      remove(next);
4532
                  }
4533
                  else {
4534
                      break;
4535
                  }
4536
              }
4537
          }
4538
          const next = nextSibling(node);
4539
          const container = parentNode(node);
4540
          remove(node);
4541
          patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container));
4542
          return next;
4543
      };
4544
      const locateClosingAsyncAnchor = (node) => {
4545
          let match = 0;
4546
          while (node) {
4547
              node = nextSibling(node);
4548
              if (node && isComment(node)) {
4549
                  if (node.data === '[')
4550
                      match++;
4551
                  if (node.data === ']') {
4552
                      if (match === 0) {
4553
                          return nextSibling(node);
4554
                      }
4555
                      else {
4556
                          match--;
4557
                      }
4558
                  }
4559
              }
4560
          }
4561
          return node;
4562
      };
4563
      return [hydrate, hydrateNode];
4564
  }
4565
 
4566
  let supported;
4567
  let perf;
4568
  function startMeasure(instance, type) {
4569
      if (instance.appContext.config.performance && isSupported()) {
4570
          perf.mark(`vue-${type}-${instance.uid}`);
4571
      }
4572
  }
4573
  function endMeasure(instance, type) {
4574
      if (instance.appContext.config.performance && isSupported()) {
4575
          const startTag = `vue-${type}-${instance.uid}`;
4576
          const endTag = startTag + `:end`;
4577
          perf.mark(endTag);
4578
          perf.measure(`<${formatComponentName(instance, instance.type)}> ${type}`, startTag, endTag);
4579
          perf.clearMarks(startTag);
4580
          perf.clearMarks(endTag);
4581
      }
4582
  }
4583
  function isSupported() {
4584
      if (supported !== undefined) {
4585
          return supported;
4586
      }
4587
      /* eslint-disable no-restricted-globals */
4588
      if (typeof window !== 'undefined' && window.performance) {
4589
          supported = true;
4590
          perf = window.performance;
4591
      }
4592
      else {
4593
          supported = false;
4594
      }
4595
      /* eslint-enable no-restricted-globals */
4596
      return supported;
4597
  }
4598
 
4599
  // implementation, close to no-op
4600
  function defineComponent(options) {
4601
      return isFunction(options) ? { setup: options, name: options.name } : options;
4602
  }
4603
 
4604
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4605
  function defineAsyncComponent(source) {
4606
      if (isFunction(source)) {
4607
          source = { loader: source };
4608
      }
4609
      const { loader, loadingComponent: loadingComponent, errorComponent: errorComponent, delay = 200, timeout, // undefined = never times out
4610
      suspensible = true, onError: userOnError } = source;
4611
      let pendingRequest = null;
4612
      let resolvedComp;
4613
      let retries = 0;
4614
      const retry = () => {
4615
          retries++;
4616
          pendingRequest = null;
4617
          return load();
4618
      };
4619
      const load = () => {
4620
          let thisRequest;
4621
          return (pendingRequest ||
4622
              (thisRequest = pendingRequest = loader()
4623
                  .catch(err => {
4624
                  err = err instanceof Error ? err : new Error(String(err));
4625
                  if (userOnError) {
4626
                      return new Promise((resolve, reject) => {
4627
                          const userRetry = () => resolve(retry());
4628
                          const userFail = () => reject(err);
4629
                          userOnError(err, userRetry, userFail, retries + 1);
4630
                      });
4631
                  }
4632
                  else {
4633
                      throw err;
4634
                  }
4635
              })
4636
                  .then((comp) => {
4637
                  if (thisRequest !== pendingRequest && pendingRequest) {
4638
                      return pendingRequest;
4639
                  }
4640
                  if ( !comp) {
4641
                      warn(`Async component loader resolved to undefined. ` +
4642
                          `If you are using retry(), make sure to return its return value.`);
4643
                  }
4644
                  // interop module default
4645
                  if (comp &&
4646
                      (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
4647
                      comp = comp.default;
4648
                  }
4649
                  if ( comp && !isObject(comp) && !isFunction(comp)) {
4650
                      throw new Error(`Invalid async component load result: ${comp}`);
4651
                  }
4652
                  resolvedComp = comp;
4653
                  return comp;
4654
              })));
4655
      };
4656
      return defineComponent({
4657
          __asyncLoader: load,
4658
          name: 'AsyncComponentWrapper',
4659
          setup() {
4660
              const instance = currentInstance;
4661
              // already resolved
4662
              if (resolvedComp) {
4663
                  return () => createInnerComp(resolvedComp, instance);
4664
              }
4665
              const onError = (err) => {
4666
                  pendingRequest = null;
4667
                  handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
4668
              };
4669
              // suspense-controlled or SSR.
4670
              if (( suspensible && instance.suspense) ||
4671
                  (false )) {
4672
                  return load()
4673
                      .then(comp => {
4674
                      return () => createInnerComp(comp, instance);
4675
                  })
4676
                      .catch(err => {
4677
                      onError(err);
4678
                      return () => errorComponent
4679
                          ? createVNode(errorComponent, {
4680
                              error: err
4681
                          })
4682
                          : null;
4683
                  });
4684
              }
4685
              const loaded = ref(false);
4686
              const error = ref();
4687
              const delayed = ref(!!delay);
4688
              if (delay) {
4689
                  setTimeout(() => {
4690
                      delayed.value = false;
4691
                  }, delay);
4692
              }
4693
              if (timeout != null) {
4694
                  setTimeout(() => {
4695
                      if (!loaded.value && !error.value) {
4696
                          const err = new Error(`Async component timed out after ${timeout}ms.`);
4697
                          onError(err);
4698
                          error.value = err;
4699
                      }
4700
                  }, timeout);
4701
              }
4702
              load()
4703
                  .then(() => {
4704
                  loaded.value = true;
4705
              })
4706
                  .catch(err => {
4707
                  onError(err);
4708
                  error.value = err;
4709
              });
4710
              return () => {
4711
                  if (loaded.value && resolvedComp) {
4712
                      return createInnerComp(resolvedComp, instance);
4713
                  }
4714
                  else if (error.value && errorComponent) {
4715
                      return createVNode(errorComponent, {
4716
                          error: error.value
4717
                      });
4718
                  }
4719
                  else if (loadingComponent && !delayed.value) {
4720
                      return createVNode(loadingComponent);
4721
                  }
4722
              };
4723
          }
4724
      });
4725
  }
4726
  function createInnerComp(comp, { vnode: { ref, props, children } }) {
4727
      const vnode = createVNode(comp, props, children);
4728
      // ensure inner component inherits the async wrapper's ref owner
4729
      vnode.ref = ref;
4730
      return vnode;
4731
  }
4732
 
4733
  function createDevEffectOptions(instance) {
4734
      return {
4735
          scheduler: queueJob,
4736
          allowRecurse: true,
4737
          onTrack: instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0,
4738
          onTrigger: instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0
4739
      };
4740
  }
4741
  const queuePostRenderEffect =  queueEffectWithSuspense
4742
      ;
4743
  const setRef = (rawRef, oldRawRef, parentSuspense, vnode) => {
4744
      if (isArray(rawRef)) {
4745
          rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode));
4746
          return;
4747
      }
4748
      let value;
4749
      if (!vnode || isAsyncWrapper(vnode)) {
4750
          value = null;
4751
      }
4752
      else {
4753
          if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
4754
              value = vnode.component.exposed || vnode.component.proxy;
4755
          }
4756
          else {
4757
              value = vnode.el;
4758
          }
4759
      }
4760
      const { i: owner, r: ref } = rawRef;
4761
      if ( !owner) {
4762
          warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
4763
              `A vnode with ref must be created inside the render function.`);
4764
          return;
4765
      }
4766
      const oldRef = oldRawRef && oldRawRef.r;
4767
      const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
4768
      const setupState = owner.setupState;
4769
      // unset old ref
4770
      if (oldRef != null && oldRef !== ref) {
4771
          if (isString(oldRef)) {
4772
              refs[oldRef] = null;
4773
              if (hasOwn(setupState, oldRef)) {
4774
                  setupState[oldRef] = null;
4775
              }
4776
          }
4777
          else if (isRef(oldRef)) {
4778
              oldRef.value = null;
4779
          }
4780
      }
4781
      if (isString(ref)) {
4782
          const doSet = () => {
4783
              refs[ref] = value;
4784
              if (hasOwn(setupState, ref)) {
4785
                  setupState[ref] = value;
4786
              }
4787
          };
4788
          // #1789: for non-null values, set them after render
4789
          // null values means this is unmount and it should not overwrite another
4790
          // ref with the same key
4791
          if (value) {
4792
              doSet.id = -1;
4793
              queuePostRenderEffect(doSet, parentSuspense);
4794
          }
4795
          else {
4796
              doSet();
4797
          }
4798
      }
4799
      else if (isRef(ref)) {
4800
          const doSet = () => {
4801
              ref.value = value;
4802
          };
4803
          if (value) {
4804
              doSet.id = -1;
4805
              queuePostRenderEffect(doSet, parentSuspense);
4806
          }
4807
          else {
4808
              doSet();
4809
          }
4810
      }
4811
      else if (isFunction(ref)) {
4812
          callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
4813
      }
4814
      else {
4815
          warn('Invalid template ref type:', value, `(${typeof value})`);
4816
      }
4817
  };
4818
  /**
4819
   * The createRenderer function accepts two generic arguments:
4820
   * HostNode and HostElement, corresponding to Node and Element types in the
4821
   * host environment. For example, for runtime-dom, HostNode would be the DOM
4822
   * `Node` interface and HostElement would be the DOM `Element` interface.
4823
   *
4824
   * Custom renderers can pass in the platform specific types like this:
4825
   *
4826
   * ``` js
4827
   * const { render, createApp } = createRenderer<Node, Element>({
4828
   *   patchProp,
4829
   *   ...nodeOps
4830
   * })
4831
   * ```
4832
   */
4833
  function createRenderer(options) {
4834
      return baseCreateRenderer(options);
4835
  }
4836
  // Separate API for creating hydration-enabled renderer.
4837
  // Hydration logic is only used when calling this function, making it
4838
  // tree-shakable.
4839
  function createHydrationRenderer(options) {
4840
      return baseCreateRenderer(options, createHydrationFunctions);
4841
  }
4842
  // implementation
4843
  function baseCreateRenderer(options, createHydrationFns) {
4844
      const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
4845
      // Note: functions inside this closure should use `const xxx = () => {}`
4846
      // style in order to prevent being inlined by minifiers.
4847
      const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, optimized = false) => {
4848
          // patching & not same type, unmount old tree
4849
          if (n1 && !isSameVNodeType(n1, n2)) {
4850
              anchor = getNextHostNode(n1);
4851
              unmount(n1, parentComponent, parentSuspense, true);
4852
              n1 = null;
4853
          }
4854
          if (n2.patchFlag === -2 /* BAIL */) {
4855
              optimized = false;
4856
              n2.dynamicChildren = null;
4857
          }
4858
          const { type, ref, shapeFlag } = n2;
4859
          switch (type) {
4860
              case Text:
4861
                  processText(n1, n2, container, anchor);
4862
                  break;
4863
              case Comment:
4864
                  processCommentNode(n1, n2, container, anchor);
4865
                  break;
4866
              case Static:
4867
                  if (n1 == null) {
4868
                      mountStaticNode(n2, container, anchor, isSVG);
4869
                  }
4870
                  else {
4871
                      patchStaticNode(n1, n2, container, isSVG);
4872
                  }
4873
                  break;
4874
              case Fragment:
4875
                  processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
4876
                  break;
4877
              default:
4878
                  if (shapeFlag & 1 /* ELEMENT */) {
4879
                      processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
4880
                  }
4881
                  else if (shapeFlag & 6 /* COMPONENT */) {
4882
                      processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
4883
                  }
4884
                  else if (shapeFlag & 64 /* TELEPORT */) {
4885
                      type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);
4886
                  }
4887
                  else if ( shapeFlag & 128 /* SUSPENSE */) {
4888
                      type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);
4889
                  }
4890
                  else {
4891
                      warn('Invalid VNode type:', type, `(${typeof type})`);
4892
                  }
4893
          }
4894
          // set ref
4895
          if (ref != null && parentComponent) {
4896
              setRef(ref, n1 && n1.ref, parentSuspense, n2);
4897
          }
4898
      };
4899
      const processText = (n1, n2, container, anchor) => {
4900
          if (n1 == null) {
4901
              hostInsert((n2.el = hostCreateText(n2.children)), container, anchor);
4902
          }
4903
          else {
4904
              const el = (n2.el = n1.el);
4905
              if (n2.children !== n1.children) {
4906
                  hostSetText(el, n2.children);
4907
              }
4908
          }
4909
      };
4910
      const processCommentNode = (n1, n2, container, anchor) => {
4911
          if (n1 == null) {
4912
              hostInsert((n2.el = hostCreateComment(n2.children || '')), container, anchor);
4913
          }
4914
          else {
4915
              // there's no support for dynamic comments
4916
              n2.el = n1.el;
4917
          }
4918
      };
4919
      const mountStaticNode = (n2, container, anchor, isSVG) => {
4920
          [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
4921
      };
4922
      /**
4923
       * Dev / HMR only
4924
       */
4925
      const patchStaticNode = (n1, n2, container, isSVG) => {
4926
          // static nodes are only patched during dev for HMR
4927
          if (n2.children !== n1.children) {
4928
              const anchor = hostNextSibling(n1.anchor);
4929
              // remove existing
4930
              removeStaticNode(n1);
4931
              [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
4932
          }
4933
          else {
4934
              n2.el = n1.el;
4935
              n2.anchor = n1.anchor;
4936
          }
4937
      };
4938
      const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
4939
          let next;
4940
          while (el && el !== anchor) {
4941
              next = hostNextSibling(el);
4942
              hostInsert(el, container, nextSibling);
4943
              el = next;
4944
          }
4945
          hostInsert(anchor, container, nextSibling);
4946
      };
4947
      const removeStaticNode = ({ el, anchor }) => {
4948
          let next;
4949
          while (el && el !== anchor) {
4950
              next = hostNextSibling(el);
4951
              hostRemove(el);
4952
              el = next;
4953
          }
4954
          hostRemove(anchor);
4955
      };
4956
      const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
4957
          isSVG = isSVG || n2.type === 'svg';
4958
          if (n1 == null) {
4959
              mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
4960
          }
4961
          else {
4962
              patchElement(n1, n2, parentComponent, parentSuspense, isSVG, optimized);
4963
          }
4964
      };
4965
      const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
4966
          let el;
4967
          let vnodeHook;
4968
          const { type, props, shapeFlag, transition, scopeId, patchFlag, dirs } = vnode;
4969
          {
4970
              el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is);
4971
              // mount children first, since some props may rely on child content
4972
              // being already rendered, e.g. `<select value>`
4973
              if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4974
                  hostSetElementText(el, vnode.children);
4975
              }
4976
              else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4977
                  mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', optimized || !!vnode.dynamicChildren);
4978
              }
4979
              if (dirs) {
4980
                  invokeDirectiveHook(vnode, null, parentComponent, 'created');
4981
              }
4982
              // props
4983
              if (props) {
4984
                  for (const key in props) {
4985
                      if (!isReservedProp(key)) {
4986
                          hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
4987
                      }
4988
                  }
4989
                  if ((vnodeHook = props.onVnodeBeforeMount)) {
4990
                      invokeVNodeHook(vnodeHook, parentComponent, vnode);
4991
                  }
4992
              }
4993
              // scopeId
4994
              setScopeId(el, scopeId, vnode, parentComponent);
4995
          }
4996
          {
4997
              Object.defineProperty(el, '__vnode', {
4998
                  value: vnode,
4999
                  enumerable: false
5000
              });
5001
              Object.defineProperty(el, '__vueParentComponent', {
5002
                  value: parentComponent,
5003
                  enumerable: false
5004
              });
5005
          }
5006
          if (dirs) {
5007
              invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
5008
          }
5009
          // #1583 For inside suspense + suspense not resolved case, enter hook should call when suspense resolved
5010
          // #1689 For inside suspense + suspense resolved case, just call it
5011
          const needCallTransitionHooks = (!parentSuspense || (parentSuspense && !parentSuspense.pendingBranch)) &&
5012
              transition &&
5013
              !transition.persisted;
5014
          if (needCallTransitionHooks) {
5015
              transition.beforeEnter(el);
5016
          }
5017
          hostInsert(el, container, anchor);
5018
          if ((vnodeHook = props && props.onVnodeMounted) ||
5019
              needCallTransitionHooks ||
5020
              dirs) {
5021
              queuePostRenderEffect(() => {
5022
                  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5023
                  needCallTransitionHooks && transition.enter(el);
5024
                  dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
5025
              }, parentSuspense);
5026
          }
5027
      };
5028
      const setScopeId = (el, scopeId, vnode, parentComponent) => {
5029
          if (scopeId) {
5030
              hostSetScopeId(el, scopeId);
5031
          }
5032
          if (parentComponent) {
5033
              const treeOwnerId = parentComponent.type.__scopeId;
5034
              // vnode's own scopeId and the current patched component's scopeId is
5035
              // different - this is a slot content node.
5036
              if (treeOwnerId && treeOwnerId !== scopeId) {
5037
                  hostSetScopeId(el, treeOwnerId + '-s');
5038
              }
5039
              let subTree = parentComponent.subTree;
5040
              if ( subTree.type === Fragment) {
5041
                  subTree =
5042
                      filterSingleRoot(subTree.children) || subTree;
5043
              }
5044
              if (vnode === subTree) {
5045
                  setScopeId(el, parentComponent.vnode.scopeId, parentComponent.vnode, parentComponent.parent);
5046
              }
5047
          }
5048
      };
5049
      const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, optimized, start = 0) => {
5050
          for (let i = start; i < children.length; i++) {
5051
              const child = (children[i] = optimized
5052
                  ? cloneIfMounted(children[i])
5053
                  : normalizeVNode(children[i]));
5054
              patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5055
          }
5056
      };
5057
      const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, optimized) => {
5058
          const el = (n2.el = n1.el);
5059
          let { patchFlag, dynamicChildren, dirs } = n2;
5060
          // #1426 take the old vnode's patch flag into account since user may clone a
5061
          // compiler-generated vnode, which de-opts to FULL_PROPS
5062
          patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
5063
          const oldProps = n1.props || EMPTY_OBJ;
5064
          const newProps = n2.props || EMPTY_OBJ;
5065
          let vnodeHook;
5066
          if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
5067
              invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5068
          }
5069
          if (dirs) {
5070
              invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
5071
          }
5072
          if ( isHmrUpdating) {
5073
              // HMR updated, force full diff
5074
              patchFlag = 0;
5075
              optimized = false;
5076
              dynamicChildren = null;
5077
          }
5078
          if (patchFlag > 0) {
5079
              // the presence of a patchFlag means this element's render code was
5080
              // generated by the compiler and can take the fast path.
5081
              // in this path old node and new node are guaranteed to have the same shape
5082
              // (i.e. at the exact same position in the source template)
5083
              if (patchFlag & 16 /* FULL_PROPS */) {
5084
                  // element props contain dynamic keys, full diff needed
5085
                  patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
5086
              }
5087
              else {
5088
                  // class
5089
                  // this flag is matched when the element has dynamic class bindings.
5090
                  if (patchFlag & 2 /* CLASS */) {
5091
                      if (oldProps.class !== newProps.class) {
5092
                          hostPatchProp(el, 'class', null, newProps.class, isSVG);
5093
                      }
5094
                  }
5095
                  // style
5096
                  // this flag is matched when the element has dynamic style bindings
5097
                  if (patchFlag & 4 /* STYLE */) {
5098
                      hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
5099
                  }
5100
                  // props
5101
                  // This flag is matched when the element has dynamic prop/attr bindings
5102
                  // other than class and style. The keys of dynamic prop/attrs are saved for
5103
                  // faster iteration.
5104
                  // Note dynamic keys like :[foo]="bar" will cause this optimization to
5105
                  // bail out and go through a full diff because we need to unset the old key
5106
                  if (patchFlag & 8 /* PROPS */) {
5107
                      // if the flag is present then dynamicProps must be non-null
5108
                      const propsToUpdate = n2.dynamicProps;
5109
                      for (let i = 0; i < propsToUpdate.length; i++) {
5110
                          const key = propsToUpdate[i];
5111
                          const prev = oldProps[key];
5112
                          const next = newProps[key];
5113
                          if (next !== prev ||
5114
                              (hostForcePatchProp && hostForcePatchProp(el, key))) {
5115
                              hostPatchProp(el, key, prev, next, isSVG, n1.children, parentComponent, parentSuspense, unmountChildren);
5116
                          }
5117
                      }
5118
                  }
5119
              }
5120
              // text
5121
              // This flag is matched when the element has only dynamic text children.
5122
              if (patchFlag & 1 /* TEXT */) {
5123
                  if (n1.children !== n2.children) {
5124
                      hostSetElementText(el, n2.children);
5125
                  }
5126
              }
5127
          }
5128
          else if (!optimized && dynamicChildren == null) {
5129
              // unoptimized, full diff
5130
              patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
5131
          }
5132
          const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
5133
          if (dynamicChildren) {
5134
              patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG);
5135
              if ( parentComponent && parentComponent.type.__hmrId) {
5136
                  traverseStaticChildren(n1, n2);
5137
              }
5138
          }
5139
          else if (!optimized) {
5140
              // full diff
5141
              patchChildren(n1, n2, el, null, parentComponent, parentSuspense, areChildrenSVG);
5142
          }
5143
          if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
5144
              queuePostRenderEffect(() => {
5145
                  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5146
                  dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated');
5147
              }, parentSuspense);
5148
          }
5149
      };
5150
      // The fast path for blocks.
5151
      const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG) => {
5152
          for (let i = 0; i < newChildren.length; i++) {
5153
              const oldVNode = oldChildren[i];
5154
              const newVNode = newChildren[i];
5155
              // Determine the container (parent element) for the patch.
5156
              const container =
5157
              // - In the case of a Fragment, we need to provide the actual parent
5158
              // of the Fragment itself so it can move its children.
5159
              oldVNode.type === Fragment ||
5160
                  // - In the case of different nodes, there is going to be a replacement
5161
                  // which also requires the correct parent container
5162
                  !isSameVNodeType(oldVNode, newVNode) ||
5163
                  // - In the case of a component, it could contain anything.
5164
                  oldVNode.shapeFlag & 6 /* COMPONENT */ ||
5165
                  oldVNode.shapeFlag & 64 /* TELEPORT */
5166
                  ? hostParentNode(oldVNode.el)
5167
                  : // In other cases, the parent container is not actually used so we
5168
                      // just pass the block element here to avoid a DOM parentNode call.
5169
                      fallbackContainer;
5170
              patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, true);
5171
          }
5172
      };
5173
      const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
5174
          if (oldProps !== newProps) {
5175
              for (const key in newProps) {
5176
                  // empty string is not valid prop
5177
                  if (isReservedProp(key))
5178
                      continue;
5179
                  const next = newProps[key];
5180
                  const prev = oldProps[key];
5181
                  if (next !== prev ||
5182
                      (hostForcePatchProp && hostForcePatchProp(el, key))) {
5183
                      hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
5184
                  }
5185
              }
5186
              if (oldProps !== EMPTY_OBJ) {
5187
                  for (const key in oldProps) {
5188
                      if (!isReservedProp(key) && !(key in newProps)) {
5189
                          hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
5190
                      }
5191
                  }
5192
              }
5193
          }
5194
      };
5195
      const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5196
          const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
5197
          const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
5198
          let { patchFlag, dynamicChildren } = n2;
5199
          if (patchFlag > 0) {
5200
              optimized = true;
5201
          }
5202
          if ( isHmrUpdating) {
5203
              // HMR updated, force full diff
5204
              patchFlag = 0;
5205
              optimized = false;
5206
              dynamicChildren = null;
5207
          }
5208
          if (n1 == null) {
5209
              hostInsert(fragmentStartAnchor, container, anchor);
5210
              hostInsert(fragmentEndAnchor, container, anchor);
5211
              // a fragment can only have array children
5212
              // since they are either generated by the compiler, or implicitly created
5213
              // from arrays.
5214
              mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, optimized);
5215
          }
5216
          else {
5217
              if (patchFlag > 0 &&
5218
                  patchFlag & 64 /* STABLE_FRAGMENT */ &&
5219
                  dynamicChildren &&
5220
                  // #2715 the previous fragment could've been a BAILed one as a result
5221
                  // of renderSlot() with no valid children
5222
                  n1.dynamicChildren) {
5223
                  // a stable fragment (template root or <template v-for>) doesn't need to
5224
                  // patch children order, but it may contain dynamicChildren.
5225
                  patchBlockChildren(n1.dynamicChildren, dynamicChildren, container, parentComponent, parentSuspense, isSVG);
5226
                  if ( parentComponent && parentComponent.type.__hmrId) {
5227
                      traverseStaticChildren(n1, n2);
5228
                  }
5229
                  else if (
5230
                  // #2080 if the stable fragment has a key, it's a <template v-for> that may
5231
                  //  get moved around. Make sure all root level vnodes inherit el.
5232
                  // #2134 or if it's a component root, it may also get moved around
5233
                  // as the component is being moved.
5234
                  n2.key != null ||
5235
                      (parentComponent && n2 === parentComponent.subTree)) {
5236
                      traverseStaticChildren(n1, n2, true /* shallow */);
5237
                  }
5238
              }
5239
              else {
5240
                  // keyed / unkeyed, or manual fragments.
5241
                  // for keyed & unkeyed, since they are compiler generated from v-for,
5242
                  // each child is guaranteed to be a block so the fragment will never
5243
                  // have dynamicChildren.
5244
                  patchChildren(n1, n2, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, optimized);
5245
              }
5246
          }
5247
      };
5248
      const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5249
          if (n1 == null) {
5250
              if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
5251
                  parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
5252
              }
5253
              else {
5254
                  mountComponent(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5255
              }
5256
          }
5257
          else {
5258
              updateComponent(n1, n2, optimized);
5259
          }
5260
      };
5261
      const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5262
          const instance = (initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense));
5263
          if ( instance.type.__hmrId) {
5264
              registerHMR(instance);
5265
          }
5266
          {
5267
              pushWarningContext(initialVNode);
5268
              startMeasure(instance, `mount`);
5269
          }
5270
          // inject renderer internals for keepAlive
5271
          if (isKeepAlive(initialVNode)) {
5272
              instance.ctx.renderer = internals;
5273
          }
5274
          // resolve props and slots for setup context
5275
          {
5276
              startMeasure(instance, `init`);
5277
          }
5278
          setupComponent(instance);
5279
          {
5280
              endMeasure(instance, `init`);
5281
          }
5282
          // setup() is async. This component relies on async logic to be resolved
5283
          // before proceeding
5284
          if ( instance.asyncDep) {
5285
              parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
5286
              // Give it a placeholder if this is not hydration
5287
              // TODO handle self-defined fallback
5288
              if (!initialVNode.el) {
5289
                  const placeholder = (instance.subTree = createVNode(Comment));
5290
                  processCommentNode(null, placeholder, container, anchor);
5291
              }
5292
              return;
5293
          }
5294
          setupRenderEffect(instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized);
5295
          {
5296
              popWarningContext();
5297
              endMeasure(instance, `mount`);
5298
          }
5299
      };
5300
      const updateComponent = (n1, n2, optimized) => {
5301
          const instance = (n2.component = n1.component);
5302
          if (shouldUpdateComponent(n1, n2, optimized)) {
5303
              if (
5304
                  instance.asyncDep &&
5305
                  !instance.asyncResolved) {
5306
                  // async & still pending - just update props and slots
5307
                  // since the component's reactive effect for render isn't set-up yet
5308
                  {
5309
                      pushWarningContext(n2);
5310
                  }
5311
                  updateComponentPreRender(instance, n2, optimized);
5312
                  {
5313
                      popWarningContext();
5314
                  }
5315
                  return;
5316
              }
5317
              else {
5318
                  // normal update
5319
                  instance.next = n2;
5320
                  // in case the child component is also queued, remove it to avoid
5321
                  // double updating the same child component in the same flush.
5322
                  invalidateJob(instance.update);
5323
                  // instance.update is the reactive effect runner.
5324
                  instance.update();
5325
              }
5326
          }
5327
          else {
5328
              // no update needed. just copy over properties
5329
              n2.component = n1.component;
5330
              n2.el = n1.el;
5331
              instance.vnode = n2;
5332
          }
5333
      };
5334
      const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
5335
          // create reactive effect for rendering
5336
          instance.update = effect(function componentEffect() {
5337
              if (!instance.isMounted) {
5338
                  let vnodeHook;
5339
                  const { el, props } = initialVNode;
5340
                  const { bm, m, parent } = instance;
5341
                  // beforeMount hook
5342
                  if (bm) {
5343
                      invokeArrayFns(bm);
5344
                  }
5345
                  // onVnodeBeforeMount
5346
                  if ((vnodeHook = props && props.onVnodeBeforeMount)) {
5347
                      invokeVNodeHook(vnodeHook, parent, initialVNode);
5348
                  }
5349
                  // render
5350
                  {
5351
                      startMeasure(instance, `render`);
5352
                  }
5353
                  const subTree = (instance.subTree = renderComponentRoot(instance));
5354
                  {
5355
                      endMeasure(instance, `render`);
5356
                  }
5357
                  if (el && hydrateNode) {
5358
                      {
5359
                          startMeasure(instance, `hydrate`);
5360
                      }
5361
                      // vnode has adopted host node - perform hydration instead of mount.
5362
                      hydrateNode(initialVNode.el, subTree, instance, parentSuspense);
5363
                      {
5364
                          endMeasure(instance, `hydrate`);
5365
                      }
5366
                  }
5367
                  else {
5368
                      {
5369
                          startMeasure(instance, `patch`);
5370
                      }
5371
                      patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
5372
                      {
5373
                          endMeasure(instance, `patch`);
5374
                      }
5375
                      initialVNode.el = subTree.el;
5376
                  }
5377
                  // mounted hook
5378
                  if (m) {
5379
                      queuePostRenderEffect(m, parentSuspense);
5380
                  }
5381
                  // onVnodeMounted
5382
                  if ((vnodeHook = props && props.onVnodeMounted)) {
5383
                      const scopedInitialVNode = initialVNode;
5384
                      queuePostRenderEffect(() => {
5385
                          invokeVNodeHook(vnodeHook, parent, scopedInitialVNode);
5386
                      }, parentSuspense);
5387
                  }
5388
                  // activated hook for keep-alive roots.
5389
                  // #1742 activated hook must be accessed after first render
5390
                  // since the hook may be injected by a child keep-alive
5391
                  const { a } = instance;
5392
                  if (a &&
5393
                      initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
5394
                      queuePostRenderEffect(a, parentSuspense);
5395
                  }
5396
                  instance.isMounted = true;
5397
                  // #2458: deference mount-only object parameters to prevent memleaks
5398
                  initialVNode = container = anchor = null;
5399
              }
5400
              else {
5401
                  // updateComponent
5402
                  // This is triggered by mutation of component's own state (next: null)
5403
                  // OR parent calling processComponent (next: VNode)
5404
                  let { next, bu, u, parent, vnode } = instance;
5405
                  let originNext = next;
5406
                  let vnodeHook;
5407
                  {
5408
                      pushWarningContext(next || instance.vnode);
5409
                  }
5410
                  if (next) {
5411
                      next.el = vnode.el;
5412
                      updateComponentPreRender(instance, next, optimized);
5413
                  }
5414
                  else {
5415
                      next = vnode;
5416
                  }
5417
                  // beforeUpdate hook
5418
                  if (bu) {
5419
                      invokeArrayFns(bu);
5420
                  }
5421
                  // onVnodeBeforeUpdate
5422
                  if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
5423
                      invokeVNodeHook(vnodeHook, parent, next, vnode);
5424
                  }
5425
                  // render
5426
                  {
5427
                      startMeasure(instance, `render`);
5428
                  }
5429
                  const nextTree = renderComponentRoot(instance);
5430
                  {
5431
                      endMeasure(instance, `render`);
5432
                  }
5433
                  const prevTree = instance.subTree;
5434
                  instance.subTree = nextTree;
5435
                  {
5436
                      startMeasure(instance, `patch`);
5437
                  }
5438
                  patch(prevTree, nextTree,
5439
                  // parent may have changed if it's in a teleport
5440
                  hostParentNode(prevTree.el),
5441
                  // anchor may have changed if it's in a fragment
5442
                  getNextHostNode(prevTree), instance, parentSuspense, isSVG);
5443
                  {
5444
                      endMeasure(instance, `patch`);
5445
                  }
5446
                  next.el = nextTree.el;
5447
                  if (originNext === null) {
5448
                      // self-triggered update. In case of HOC, update parent component
5449
                      // vnode el. HOC is indicated by parent instance's subTree pointing
5450
                      // to child component's vnode
5451
                      updateHOCHostEl(instance, nextTree.el);
5452
                  }
5453
                  // updated hook
5454
                  if (u) {
5455
                      queuePostRenderEffect(u, parentSuspense);
5456
                  }
5457
                  // onVnodeUpdated
5458
                  if ((vnodeHook = next.props && next.props.onVnodeUpdated)) {
5459
                      queuePostRenderEffect(() => {
5460
                          invokeVNodeHook(vnodeHook, parent, next, vnode);
5461
                      }, parentSuspense);
5462
                  }
5463
                  {
5464
                      devtoolsComponentUpdated(instance);
5465
                  }
5466
                  {
5467
                      popWarningContext();
5468
                  }
5469
              }
5470
          },  createDevEffectOptions(instance) );
5471
      };
5472
      const updateComponentPreRender = (instance, nextVNode, optimized) => {
5473
          nextVNode.component = instance;
5474
          const prevProps = instance.vnode.props;
5475
          instance.vnode = nextVNode;
5476
          instance.next = null;
5477
          updateProps(instance, nextVNode.props, prevProps, optimized);
5478
          updateSlots(instance, nextVNode.children);
5479
          // props update may have triggered pre-flush watchers.
5480
          // flush them before the render update.
5481
          flushPreFlushCbs(undefined, instance.update);
5482
      };
5483
      const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized = false) => {
5484
          const c1 = n1 && n1.children;
5485
          const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5486
          const c2 = n2.children;
5487
          const { patchFlag, shapeFlag } = n2;
5488
          // fast path
5489
          if (patchFlag > 0) {
5490
              if (patchFlag & 128 /* KEYED_FRAGMENT */) {
5491
                  // this could be either fully-keyed or mixed (some keyed some not)
5492
                  // presence of patchFlag means children are guaranteed to be arrays
5493
                  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5494
                  return;
5495
              }
5496
              else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
5497
                  // unkeyed
5498
                  patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5499
                  return;
5500
              }
5501
          }
5502
          // children has 3 possibilities: text, array or no children.
5503
          if (shapeFlag & 8 /* TEXT_CHILDREN */) {
5504
              // text children fast path
5505
              if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
5506
                  unmountChildren(c1, parentComponent, parentSuspense);
5507
              }
5508
              if (c2 !== c1) {
5509
                  hostSetElementText(container, c2);
5510
              }
5511
          }
5512
          else {
5513
              if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
5514
                  // prev children was array
5515
                  if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5516
                      // two arrays, cannot assume anything, do full diff
5517
                      patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5518
                  }
5519
                  else {
5520
                      // no new children, just unmount old
5521
                      unmountChildren(c1, parentComponent, parentSuspense, true);
5522
                  }
5523
              }
5524
              else {
5525
                  // prev children was text OR null
5526
                  // new children is array OR null
5527
                  if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
5528
                      hostSetElementText(container, '');
5529
                  }
5530
                  // mount new if array
5531
                  if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5532
                      mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
5533
                  }
5534
              }
5535
          }
5536
      };
5537
      const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5538
          c1 = c1 || EMPTY_ARR;
5539
          c2 = c2 || EMPTY_ARR;
5540
          const oldLength = c1.length;
5541
          const newLength = c2.length;
5542
          const commonLength = Math.min(oldLength, newLength);
5543
          let i;
5544
          for (i = 0; i < commonLength; i++) {
5545
              const nextChild = (c2[i] = optimized
5546
                  ? cloneIfMounted(c2[i])
5547
                  : normalizeVNode(c2[i]));
5548
              patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, optimized);
5549
          }
5550
          if (oldLength > newLength) {
5551
              // remove old
5552
              unmountChildren(c1, parentComponent, parentSuspense, true, false, commonLength);
5553
          }
5554
          else {
5555
              // mount new
5556
              mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, commonLength);
5557
          }
5558
      };
5559
      // can be all-keyed or mixed
5560
      const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, optimized) => {
5561
          let i = 0;
5562
          const l2 = c2.length;
5563
          let e1 = c1.length - 1; // prev ending index
5564
          let e2 = l2 - 1; // next ending index
5565
          // 1. sync from start
5566
          // (a b) c
5567
          // (a b) d e
5568
          while (i <= e1 && i <= e2) {
5569
              const n1 = c1[i];
5570
              const n2 = (c2[i] = optimized
5571
                  ? cloneIfMounted(c2[i])
5572
                  : normalizeVNode(c2[i]));
5573
              if (isSameVNodeType(n1, n2)) {
5574
                  patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, optimized);
5575
              }
5576
              else {
5577
                  break;
5578
              }
5579
              i++;
5580
          }
5581
          // 2. sync from end
5582
          // a (b c)
5583
          // d e (b c)
5584
          while (i <= e1 && i <= e2) {
5585
              const n1 = c1[e1];
5586
              const n2 = (c2[e2] = optimized
5587
                  ? cloneIfMounted(c2[e2])
5588
                  : normalizeVNode(c2[e2]));
5589
              if (isSameVNodeType(n1, n2)) {
5590
                  patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, optimized);
5591
              }
5592
              else {
5593
                  break;
5594
              }
5595
              e1--;
5596
              e2--;
5597
          }
5598
          // 3. common sequence + mount
5599
          // (a b)
5600
          // (a b) c
5601
          // i = 2, e1 = 1, e2 = 2
5602
          // (a b)
5603
          // c (a b)
5604
          // i = 0, e1 = -1, e2 = 0
5605
          if (i > e1) {
5606
              if (i <= e2) {
5607
                  const nextPos = e2 + 1;
5608
                  const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
5609
                  while (i <= e2) {
5610
                      patch(null, (c2[i] = optimized
5611
                          ? cloneIfMounted(c2[i])
5612
                          : normalizeVNode(c2[i])), container, anchor, parentComponent, parentSuspense, isSVG);
5613
                      i++;
5614
                  }
5615
              }
5616
          }
5617
          // 4. common sequence + unmount
5618
          // (a b) c
5619
          // (a b)
5620
          // i = 2, e1 = 2, e2 = 1
5621
          // a (b c)
5622
          // (b c)
5623
          // i = 0, e1 = 0, e2 = -1
5624
          else if (i > e2) {
5625
              while (i <= e1) {
5626
                  unmount(c1[i], parentComponent, parentSuspense, true);
5627
                  i++;
5628
              }
5629
          }
5630
          // 5. unknown sequence
5631
          // [i ... e1 + 1]: a b [c d e] f g
5632
          // [i ... e2 + 1]: a b [e d c h] f g
5633
          // i = 2, e1 = 4, e2 = 5
5634
          else {
5635
              const s1 = i; // prev starting index
5636
              const s2 = i; // next starting index
5637
              // 5.1 build key:index map for newChildren
5638
              const keyToNewIndexMap = new Map();
5639
              for (i = s2; i <= e2; i++) {
5640
                  const nextChild = (c2[i] = optimized
5641
                      ? cloneIfMounted(c2[i])
5642
                      : normalizeVNode(c2[i]));
5643
                  if (nextChild.key != null) {
5644
                      if ( keyToNewIndexMap.has(nextChild.key)) {
5645
                          warn(`Duplicate keys found during update:`, JSON.stringify(nextChild.key), `Make sure keys are unique.`);
5646
                      }
5647
                      keyToNewIndexMap.set(nextChild.key, i);
5648
                  }
5649
              }
5650
              // 5.2 loop through old children left to be patched and try to patch
5651
              // matching nodes & remove nodes that are no longer present
5652
              let j;
5653
              let patched = 0;
5654
              const toBePatched = e2 - s2 + 1;
5655
              let moved = false;
5656
              // used to track whether any node has moved
5657
              let maxNewIndexSoFar = 0;
5658
              // works as Map<newIndex, oldIndex>
5659
              // Note that oldIndex is offset by +1
5660
              // and oldIndex = 0 is a special value indicating the new node has
5661
              // no corresponding old node.
5662
              // used for determining longest stable subsequence
5663
              const newIndexToOldIndexMap = new Array(toBePatched);
5664
              for (i = 0; i < toBePatched; i++)
5665
                  newIndexToOldIndexMap[i] = 0;
5666
              for (i = s1; i <= e1; i++) {
5667
                  const prevChild = c1[i];
5668
                  if (patched >= toBePatched) {
5669
                      // all new children have been patched so this can only be a removal
5670
                      unmount(prevChild, parentComponent, parentSuspense, true);
5671
                      continue;
5672
                  }
5673
                  let newIndex;
5674
                  if (prevChild.key != null) {
5675
                      newIndex = keyToNewIndexMap.get(prevChild.key);
5676
                  }
5677
                  else {
5678
                      // key-less node, try to locate a key-less node of the same type
5679
                      for (j = s2; j <= e2; j++) {
5680
                          if (newIndexToOldIndexMap[j - s2] === 0 &&
5681
                              isSameVNodeType(prevChild, c2[j])) {
5682
                              newIndex = j;
5683
                              break;
5684
                          }
5685
                      }
5686
                  }
5687
                  if (newIndex === undefined) {
5688
                      unmount(prevChild, parentComponent, parentSuspense, true);
5689
                  }
5690
                  else {
5691
                      newIndexToOldIndexMap[newIndex - s2] = i + 1;
5692
                      if (newIndex >= maxNewIndexSoFar) {
5693
                          maxNewIndexSoFar = newIndex;
5694
                      }
5695
                      else {
5696
                          moved = true;
5697
                      }
5698
                      patch(prevChild, c2[newIndex], container, null, parentComponent, parentSuspense, isSVG, optimized);
5699
                      patched++;
5700
                  }
5701
              }
5702
              // 5.3 move and mount
5703
              // generate longest stable subsequence only when nodes have moved
5704
              const increasingNewIndexSequence = moved
5705
                  ? getSequence(newIndexToOldIndexMap)
5706
                  : EMPTY_ARR;
5707
              j = increasingNewIndexSequence.length - 1;
5708
              // looping backwards so that we can use last patched node as anchor
5709
              for (i = toBePatched - 1; i >= 0; i--) {
5710
                  const nextIndex = s2 + i;
5711
                  const nextChild = c2[nextIndex];
5712
                  const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
5713
                  if (newIndexToOldIndexMap[i] === 0) {
5714
                      // mount new
5715
                      patch(null, nextChild, container, anchor, parentComponent, parentSuspense, isSVG);
5716
                  }
5717
                  else if (moved) {
5718
                      // move if:
5719
                      // There is no stable subsequence (e.g. a reverse)
5720
                      // OR current node is not among the stable sequence
5721
                      if (j < 0 || i !== increasingNewIndexSequence[j]) {
5722
                          move(nextChild, container, anchor, 2 /* REORDER */);
5723
                      }
5724
                      else {
5725
                          j--;
5726
                      }
5727
                  }
5728
              }
5729
          }
5730
      };
5731
      const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5732
          const { el, type, transition, children, shapeFlag } = vnode;
5733
          if (shapeFlag & 6 /* COMPONENT */) {
5734
              move(vnode.component.subTree, container, anchor, moveType);
5735
              return;
5736
          }
5737
          if ( shapeFlag & 128 /* SUSPENSE */) {
5738
              vnode.suspense.move(container, anchor, moveType);
5739
              return;
5740
          }
5741
          if (shapeFlag & 64 /* TELEPORT */) {
5742
              type.move(vnode, container, anchor, internals);
5743
              return;
5744
          }
5745
          if (type === Fragment) {
5746
              hostInsert(el, container, anchor);
5747
              for (let i = 0; i < children.length; i++) {
5748
                  move(children[i], container, anchor, moveType);
5749
              }
5750
              hostInsert(vnode.anchor, container, anchor);
5751
              return;
5752
          }
5753
          if (type === Static) {
5754
              moveStaticNode(vnode, container, anchor);
5755
              return;
5756
          }
5757
          // single nodes
5758
          const needTransition = moveType !== 2 /* REORDER */ &&
5759
              shapeFlag & 1 /* ELEMENT */ &&
5760
              transition;
5761
          if (needTransition) {
5762
              if (moveType === 0 /* ENTER */) {
5763
                  transition.beforeEnter(el);
5764
                  hostInsert(el, container, anchor);
5765
                  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5766
              }
5767
              else {
5768
                  const { leave, delayLeave, afterLeave } = transition;
5769
                  const remove = () => hostInsert(el, container, anchor);
5770
                  const performLeave = () => {
5771
                      leave(el, () => {
5772
                          remove();
5773
                          afterLeave && afterLeave();
5774
                      });
5775
                  };
5776
                  if (delayLeave) {
5777
                      delayLeave(el, remove, performLeave);
5778
                  }
5779
                  else {
5780
                      performLeave();
5781
                  }
5782
              }
5783
          }
5784
          else {
5785
              hostInsert(el, container, anchor);
5786
          }
5787
      };
5788
      const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5789
          const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs } = vnode;
5790
          // unset ref
5791
          if (ref != null) {
5792
              setRef(ref, null, parentSuspense, null);
5793
          }
5794
          if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
5795
              parentComponent.ctx.deactivate(vnode);
5796
              return;
5797
          }
5798
          const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
5799
          let vnodeHook;
5800
          if ((vnodeHook = props && props.onVnodeBeforeUnmount)) {
5801
              invokeVNodeHook(vnodeHook, parentComponent, vnode);
5802
          }
5803
          if (shapeFlag & 6 /* COMPONENT */) {
5804
              unmountComponent(vnode.component, parentSuspense, doRemove);
5805
          }
5806
          else {
5807
              if ( shapeFlag & 128 /* SUSPENSE */) {
5808
                  vnode.suspense.unmount(parentSuspense, doRemove);
5809
                  return;
5810
              }
5811
              if (shouldInvokeDirs) {
5812
                  invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
5813
              }
5814
              if (dynamicChildren &&
5815
                  // #1153: fast path should not be taken for non-stable (v-for) fragments
5816
                  (type !== Fragment ||
5817
                      (patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
5818
                  // fast path for block nodes: only need to unmount dynamic children.
5819
                  unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
5820
              }
5821
              else if ((type === Fragment &&
5822
                  (patchFlag & 128 /* KEYED_FRAGMENT */ ||
5823
                      patchFlag & 256 /* UNKEYED_FRAGMENT */)) ||
5824
                  (!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
5825
                  unmountChildren(children, parentComponent, parentSuspense);
5826
              }
5827
              // an unmounted teleport should always remove its children if not disabled
5828
              if (shapeFlag & 64 /* TELEPORT */ &&
5829
                  (doRemove || !isTeleportDisabled(vnode.props))) {
5830
                  vnode.type.remove(vnode, internals);
5831
              }
5832
              if (doRemove) {
5833
                  remove(vnode);
5834
              }
5835
          }
5836
          if ((vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5837
              queuePostRenderEffect(() => {
5838
                  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5839
                  shouldInvokeDirs &&
5840
                      invokeDirectiveHook(vnode, null, parentComponent, 'unmounted');
5841
              }, parentSuspense);
5842
          }
5843
      };
5844
      const remove = vnode => {
5845
          const { type, el, anchor, transition } = vnode;
5846
          if (type === Fragment) {
5847
              removeFragment(el, anchor);
5848
              return;
5849
          }
5850
          if (type === Static) {
5851
              removeStaticNode(vnode);
5852
              return;
5853
          }
5854
          const performRemove = () => {
5855
              hostRemove(el);
5856
              if (transition && !transition.persisted && transition.afterLeave) {
5857
                  transition.afterLeave();
5858
              }
5859
          };
5860
          if (vnode.shapeFlag & 1 /* ELEMENT */ &&
5861
              transition &&
5862
              !transition.persisted) {
5863
              const { leave, delayLeave } = transition;
5864
              const performLeave = () => leave(el, performRemove);
5865
              if (delayLeave) {
5866
                  delayLeave(vnode.el, performRemove, performLeave);
5867
              }
5868
              else {
5869
                  performLeave();
5870
              }
5871
          }
5872
          else {
5873
              performRemove();
5874
          }
5875
      };
5876
      const removeFragment = (cur, end) => {
5877
          // For fragments, directly remove all contained DOM nodes.
5878
          // (fragment child nodes cannot have transition)
5879
          let next;
5880
          while (cur !== end) {
5881
              next = hostNextSibling(cur);
5882
              hostRemove(cur);
5883
              cur = next;
5884
          }
5885
          hostRemove(end);
5886
      };
5887
      const unmountComponent = (instance, parentSuspense, doRemove) => {
5888
          if ( instance.type.__hmrId) {
5889
              unregisterHMR(instance);
5890
          }
5891
          const { bum, effects, update, subTree, um } = instance;
5892
          // beforeUnmount hook
5893
          if (bum) {
5894
              invokeArrayFns(bum);
5895
          }
5896
          if (effects) {
5897
              for (let i = 0; i < effects.length; i++) {
5898
                  stop(effects[i]);
5899
              }
5900
          }
5901
          // update may be null if a component is unmounted before its async
5902
          // setup has resolved.
5903
          if (update) {
5904
              stop(update);
5905
              unmount(subTree, instance, parentSuspense, doRemove);
5906
          }
5907
          // unmounted hook
5908
          if (um) {
5909
              queuePostRenderEffect(um, parentSuspense);
5910
          }
5911
          queuePostRenderEffect(() => {
5912
              instance.isUnmounted = true;
5913
          }, parentSuspense);
5914
          // A component with async dep inside a pending suspense is unmounted before
5915
          // its async dep resolves. This should remove the dep from the suspense, and
5916
          // cause the suspense to resolve immediately if that was the last dep.
5917
          if (
5918
              parentSuspense &&
5919
              parentSuspense.pendingBranch &&
5920
              !parentSuspense.isUnmounted &&
5921
              instance.asyncDep &&
5922
              !instance.asyncResolved &&
5923
              instance.suspenseId === parentSuspense.pendingId) {
5924
              parentSuspense.deps--;
5925
              if (parentSuspense.deps === 0) {
5926
                  parentSuspense.resolve();
5927
              }
5928
          }
5929
          {
5930
              devtoolsComponentRemoved(instance);
5931
          }
5932
      };
5933
      const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
5934
          for (let i = start; i < children.length; i++) {
5935
              unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
5936
          }
5937
      };
5938
      const getNextHostNode = vnode => {
5939
          if (vnode.shapeFlag & 6 /* COMPONENT */) {
5940
              return getNextHostNode(vnode.component.subTree);
5941
          }
5942
          if ( vnode.shapeFlag & 128 /* SUSPENSE */) {
5943
              return vnode.suspense.next();
5944
          }
5945
          return hostNextSibling((vnode.anchor || vnode.el));
5946
      };
5947
      const render = (vnode, container) => {
5948
          if (vnode == null) {
5949
              if (container._vnode) {
5950
                  unmount(container._vnode, null, null, true);
5951
              }
5952
          }
5953
          else {
5954
              patch(container._vnode || null, vnode, container);
5955
          }
5956
          flushPostFlushCbs();
5957
          container._vnode = vnode;
5958
      };
5959
      const internals = {
5960
          p: patch,
5961
          um: unmount,
5962
          m: move,
5963
          r: remove,
5964
          mt: mountComponent,
5965
          mc: mountChildren,
5966
          pc: patchChildren,
5967
          pbc: patchBlockChildren,
5968
          n: getNextHostNode,
5969
          o: options
5970
      };
5971
      let hydrate;
5972
      let hydrateNode;
5973
      if (createHydrationFns) {
5974
          [hydrate, hydrateNode] = createHydrationFns(internals);
5975
      }
5976
      return {
5977
          render,
5978
          hydrate,
5979
          createApp: createAppAPI(render, hydrate)
5980
      };
5981
  }
5982
  function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
5983
      callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
5984
          vnode,
5985
          prevVNode
5986
      ]);
5987
  }
5988
  /**
5989
   * #1156
5990
   * When a component is HMR-enabled, we need to make sure that all static nodes
5991
   * inside a block also inherit the DOM element from the previous tree so that
5992
   * HMR updates (which are full updates) can retrieve the element for patching.
5993
   *
5994
   * #2080
5995
   * Inside keyed `template` fragment static children, if a fragment is moved,
5996
   * the children will always moved so that need inherit el form previous nodes
5997
   * to ensure correct moved position.
5998
   */
5999
  function traverseStaticChildren(n1, n2, shallow = false) {
6000
      const ch1 = n1.children;
6001
      const ch2 = n2.children;
6002
      if (isArray(ch1) && isArray(ch2)) {
6003
          for (let i = 0; i < ch1.length; i++) {
6004
              // this is only called in the optimized path so array children are
6005
              // guaranteed to be vnodes
6006
              const c1 = ch1[i];
6007
              let c2 = ch2[i];
6008
              if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
6009
                  if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
6010
                      c2 = ch2[i] = cloneIfMounted(ch2[i]);
6011
                      c2.el = c1.el;
6012
                  }
6013
                  if (!shallow)
6014
                      traverseStaticChildren(c1, c2);
6015
              }
6016
              // also inherit for comment nodes, but not placeholders (e.g. v-if which
6017
              // would have received .el during block patch)
6018
              if ( c2.type === Comment && !c2.el) {
6019
                  c2.el = c1.el;
6020
              }
6021
          }
6022
      }
6023
  }
6024
  // https://en.wikipedia.org/wiki/Longest_increasing_subsequence
6025
  function getSequence(arr) {
6026
      const p = arr.slice();
6027
      const result = [0];
6028
      let i, j, u, v, c;
6029
      const len = arr.length;
6030
      for (i = 0; i < len; i++) {
6031
          const arrI = arr[i];
6032
          if (arrI !== 0) {
6033
              j = result[result.length - 1];
6034
              if (arr[j] < arrI) {
6035
                  p[i] = j;
6036
                  result.push(i);
6037
                  continue;
6038
              }
6039
              u = 0;
6040
              v = result.length - 1;
6041
              while (u < v) {
6042
                  c = ((u + v) / 2) | 0;
6043
                  if (arr[result[c]] < arrI) {
6044
                      u = c + 1;
6045
                  }
6046
                  else {
6047
                      v = c;
6048
                  }
6049
              }
6050
              if (arrI < arr[result[u]]) {
6051
                  if (u > 0) {
6052
                      p[i] = result[u - 1];
6053
                  }
6054
                  result[u] = i;
6055
              }
6056
          }
6057
      }
6058
      u = result.length;
6059
      v = result[u - 1];
6060
      while (u-- > 0) {
6061
          result[u] = v;
6062
          v = p[v];
6063
      }
6064
      return result;
6065
  }
6066
 
6067
  const isTeleport = (type) => type.__isTeleport;
6068
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === '');
6069
  const isTargetSVG = (target) => typeof SVGElement !== 'undefined' && target instanceof SVGElement;
6070
  const resolveTarget = (props, select) => {
6071
      const targetSelector = props && props.to;
6072
      if (isString(targetSelector)) {
6073
          if (!select) {
6074
 
6075
                  warn(`Current renderer does not support string target for Teleports. ` +
6076
                      `(missing querySelector renderer option)`);
6077
              return null;
6078
          }
6079
          else {
6080
              const target = select(targetSelector);
6081
              if (!target) {
6082
 
6083
                      warn(`Failed to locate Teleport target with selector "${targetSelector}". ` +
6084
                          `Note the target element must exist before the component is mounted - ` +
6085
                          `i.e. the target cannot be rendered by the component itself, and ` +
6086
                          `ideally should be outside of the entire Vue component tree.`);
6087
              }
6088
              return target;
6089
          }
6090
      }
6091
      else {
6092
          if ( !targetSelector && !isTeleportDisabled(props)) {
6093
              warn(`Invalid Teleport target: ${targetSelector}`);
6094
          }
6095
          return targetSelector;
6096
      }
6097
  };
6098
  const TeleportImpl = {
6099
      __isTeleport: true,
6100
      process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals) {
6101
          const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
6102
          const disabled = isTeleportDisabled(n2.props);
6103
          const { shapeFlag, children } = n2;
6104
          if (n1 == null) {
6105
              // insert anchors in the main view
6106
              const placeholder = (n2.el =  createComment('teleport start')
6107
                  );
6108
              const mainAnchor = (n2.anchor =  createComment('teleport end')
6109
                  );
6110
              insert(placeholder, container, anchor);
6111
              insert(mainAnchor, container, anchor);
6112
              const target = (n2.target = resolveTarget(n2.props, querySelector));
6113
              const targetAnchor = (n2.targetAnchor = createText(''));
6114
              if (target) {
6115
                  insert(targetAnchor, target);
6116
                  // #2652 we could be teleporting from a non-SVG tree into an SVG tree
6117
                  isSVG = isSVG || isTargetSVG(target);
6118
              }
6119
              else if ( !disabled) {
6120
                  warn('Invalid Teleport target on mount:', target, `(${typeof target})`);
6121
              }
6122
              const mount = (container, anchor) => {
6123
                  // Teleport *always* has Array children. This is enforced in both the
6124
                  // compiler and vnode children normalization.
6125
                  if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
6126
                      mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
6127
                  }
6128
              };
6129
              if (disabled) {
6130
                  mount(container, mainAnchor);
6131
              }
6132
              else if (target) {
6133
                  mount(target, targetAnchor);
6134
              }
6135
          }
6136
          else {
6137
              // update content
6138
              n2.el = n1.el;
6139
              const mainAnchor = (n2.anchor = n1.anchor);
6140
              const target = (n2.target = n1.target);
6141
              const targetAnchor = (n2.targetAnchor = n1.targetAnchor);
6142
              const wasDisabled = isTeleportDisabled(n1.props);
6143
              const currentContainer = wasDisabled ? container : target;
6144
              const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
6145
              isSVG = isSVG || isTargetSVG(target);
6146
              if (n2.dynamicChildren) {
6147
                  // fast path when the teleport happens to be a block root
6148
                  patchBlockChildren(n1.dynamicChildren, n2.dynamicChildren, currentContainer, parentComponent, parentSuspense, isSVG);
6149
                  // even in block tree mode we need to make sure all root-level nodes
6150
                  // in the teleport inherit previous DOM references so that they can
6151
                  // be moved in future patches.
6152
                  traverseStaticChildren(n1, n2, true);
6153
              }
6154
              else if (!optimized) {
6155
                  patchChildren(n1, n2, currentContainer, currentAnchor, parentComponent, parentSuspense, isSVG);
6156
              }
6157
              if (disabled) {
6158
                  if (!wasDisabled) {
6159
                      // enabled -> disabled
6160
                      // move into main container
6161
                      moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
6162
                  }
6163
              }
6164
              else {
6165
                  // target changed
6166
                  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
6167
                      const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
6168
                      if (nextTarget) {
6169
                          moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
6170
                      }
6171
                      else {
6172
                          warn('Invalid Teleport target on update:', target, `(${typeof target})`);
6173
                      }
6174
                  }
6175
                  else if (wasDisabled) {
6176
                      // disabled -> enabled
6177
                      // move into teleport target
6178
                      moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
6179
                  }
6180
              }
6181
          }
6182
      },
6183
      remove(vnode, { r: remove, o: { remove: hostRemove } }) {
6184
          const { shapeFlag, children, anchor } = vnode;
6185
          hostRemove(anchor);
6186
          if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
6187
              for (let i = 0; i < children.length; i++) {
6188
                  remove(children[i]);
6189
              }
6190
          }
6191
      },
6192
      move: moveTeleport,
6193
      hydrate: hydrateTeleport
6194
  };
6195
  function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
6196
      // move target anchor if this is a target change.
6197
      if (moveType === 0 /* TARGET_CHANGE */) {
6198
          insert(vnode.targetAnchor, container, parentAnchor);
6199
      }
6200
      const { el, anchor, shapeFlag, children, props } = vnode;
6201
      const isReorder = moveType === 2 /* REORDER */;
6202
      // move main view anchor if this is a re-order.
6203
      if (isReorder) {
6204
          insert(el, container, parentAnchor);
6205
      }
6206
      // if this is a re-order and teleport is enabled (content is in target)
6207
      // do not move children. So the opposite is: only move children if this
6208
      // is not a reorder, or the teleport is disabled
6209
      if (!isReorder || isTeleportDisabled(props)) {
6210
          // Teleport has either Array children or no children.
6211
          if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
6212
              for (let i = 0; i < children.length; i++) {
6213
                  move(children[i], container, parentAnchor, 2 /* REORDER */);
6214
              }
6215
          }
6216
      }
6217
      // move main view anchor if this is a re-order.
6218
      if (isReorder) {
6219
          insert(anchor, container, parentAnchor);
6220
      }
6221
  }
6222
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, optimized, { o: { nextSibling, parentNode, querySelector } }, hydrateChildren) {
6223
      const target = (vnode.target = resolveTarget(vnode.props, querySelector));
6224
      if (target) {
6225
          // if multiple teleports rendered to the same target element, we need to
6226
          // pick up from where the last teleport finished instead of the first node
6227
          const targetNode = target._lpa || target.firstChild;
6228
          if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
6229
              if (isTeleportDisabled(vnode.props)) {
6230
                  vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, optimized);
6231
                  vnode.targetAnchor = targetNode;
6232
              }
6233
              else {
6234
                  vnode.anchor = nextSibling(node);
6235
                  vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, optimized);
6236
              }
6237
              target._lpa =
6238
                  vnode.targetAnchor && nextSibling(vnode.targetAnchor);
6239
          }
6240
      }
6241
      return vnode.anchor && nextSibling(vnode.anchor);
6242
  }
6243
  // Force-casted public typing for h and TSX props inference
6244
  const Teleport = TeleportImpl;
6245
 
6246
  const COMPONENTS = 'components';
6247
  const DIRECTIVES = 'directives';
6248
  /**
6249
   * @private
6250
   */
6251
  function resolveComponent(name) {
6252
      return resolveAsset(COMPONENTS, name) || name;
6253
  }
6254
  const NULL_DYNAMIC_COMPONENT = Symbol();
6255
  /**
6256
   * @private
6257
   */
6258
  function resolveDynamicComponent(component) {
6259
      if (isString(component)) {
6260
          return resolveAsset(COMPONENTS, component, false) || component;
6261
      }
6262
      else {
6263
          // invalid types will fallthrough to createVNode and raise warning
6264
          return (component || NULL_DYNAMIC_COMPONENT);
6265
      }
6266
  }
6267
  /**
6268
   * @private
6269
   */
6270
  function resolveDirective(name) {
6271
      return resolveAsset(DIRECTIVES, name);
6272
  }
6273
  // implementation
6274
  function resolveAsset(type, name, warnMissing = true) {
6275
      const instance = currentRenderingInstance || currentInstance;
6276
      if (instance) {
6277
          const Component = instance.type;
6278
          // self name has highest priority
6279
          if (type === COMPONENTS) {
6280
              // special self referencing call generated by compiler
6281
              // inferred from SFC filename
6282
              if (name === `_self`) {
6283
                  return Component;
6284
              }
6285
              const selfName = getComponentName(Component);
6286
              if (selfName &&
6287
                  (selfName === name ||
6288
                      selfName === camelize(name) ||
6289
                      selfName === capitalize(camelize(name)))) {
6290
                  return Component;
6291
              }
6292
          }
6293
          const res =
6294
          // local registration
6295
          // check instance[type] first for components with mixin or extends.
6296
          resolve(instance[type] || Component[type], name) ||
6297
              // global registration
6298
              resolve(instance.appContext[type], name);
6299
          if ( warnMissing && !res) {
6300
              warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
6301
          }
6302
          return res;
6303
      }
6304
      else {
6305
          warn(`resolve${capitalize(type.slice(0, -1))} ` +
6306
              `can only be used in render() or setup().`);
6307
      }
6308
  }
6309
  function resolve(registry, name) {
6310
      return (registry &&
6311
          (registry[name] ||
6312
              registry[camelize(name)] ||
6313
              registry[capitalize(camelize(name))]));
6314
  }
6315
 
6316
  const Fragment = Symbol( 'Fragment' );
6317
  const Text = Symbol( 'Text' );
6318
  const Comment = Symbol( 'Comment' );
6319
  const Static = Symbol( 'Static' );
6320
  // Since v-if and v-for are the two possible ways node structure can dynamically
6321
  // change, once we consider v-if branches and each v-for fragment a block, we
6322
  // can divide a template into nested blocks, and within each block the node
6323
  // structure would be stable. This allows us to skip most children diffing
6324
  // and only worry about the dynamic nodes (indicated by patch flags).
6325
  const blockStack = [];
6326
  let currentBlock = null;
6327
  /**
6328
   * Open a block.
6329
   * This must be called before `createBlock`. It cannot be part of `createBlock`
6330
   * because the children of the block are evaluated before `createBlock` itself
6331
   * is called. The generated code typically looks like this:
6332
   *
6333
   * ```js
6334
   * function render() {
6335
   *   return (openBlock(),createBlock('div', null, [...]))
6336
   * }
6337
   * ```
6338
   * disableTracking is true when creating a v-for fragment block, since a v-for
6339
   * fragment always diffs its children.
6340
   *
6341
   * @private
6342
   */
6343
  function openBlock(disableTracking = false) {
6344
      blockStack.push((currentBlock = disableTracking ? null : []));
6345
  }
6346
  function closeBlock() {
6347
      blockStack.pop();
6348
      currentBlock = blockStack[blockStack.length - 1] || null;
6349
  }
6350
  // Whether we should be tracking dynamic child nodes inside a block.
6351
  // Only tracks when this value is > 0
6352
  // We are not using a simple boolean because this value may need to be
6353
  // incremented/decremented by nested usage of v-once (see below)
6354
  let shouldTrack$1 = 1;
6355
  /**
6356
   * Block tracking sometimes needs to be disabled, for example during the
6357
   * creation of a tree that needs to be cached by v-once. The compiler generates
6358
   * code like this:
6359
   *
6360
   * ``` js
6361
   * _cache[1] || (
6362
   *   setBlockTracking(-1),
6363
   *   _cache[1] = createVNode(...),
6364
   *   setBlockTracking(1),
6365
   *   _cache[1]
6366
   * )
6367
   * ```
6368
   *
6369
   * @private
6370
   */
6371
  function setBlockTracking(value) {
6372
      shouldTrack$1 += value;
6373
  }
6374
  /**
6375
   * Create a block root vnode. Takes the same exact arguments as `createVNode`.
6376
   * A block root keeps track of dynamic nodes within the block in the
6377
   * `dynamicChildren` array.
6378
   *
6379
   * @private
6380
   */
6381
  function createBlock(type, props, children, patchFlag, dynamicProps) {
6382
      const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);
6383
      // save current block children on the block vnode
6384
      vnode.dynamicChildren = currentBlock || EMPTY_ARR;
6385
      // close block
6386
      closeBlock();
6387
      // a block is always going to be patched, so track it as a child of its
6388
      // parent block
6389
      if (shouldTrack$1 > 0 && currentBlock) {
6390
          currentBlock.push(vnode);
6391
      }
6392
      return vnode;
6393
  }
6394
  function isVNode(value) {
6395
      return value ? value.__v_isVNode === true : false;
6396
  }
6397
  function isSameVNodeType(n1, n2) {
6398
      if (
6399
          n2.shapeFlag & 6 /* COMPONENT */ &&
6400
          hmrDirtyComponents.has(n2.type)) {
6401
          // HMR only: if the component has been hot-updated, force a reload.
6402
          return false;
6403
      }
6404
      return n1.type === n2.type && n1.key === n2.key;
6405
  }
6406
  let vnodeArgsTransformer;
6407
  /**
6408
   * Internal API for registering an arguments transform for createVNode
6409
   * used for creating stubs in the test-utils
6410
   * It is *internal* but needs to be exposed for test-utils to pick up proper
6411
   * typings
6412
   */
6413
  function transformVNodeArgs(transformer) {
6414
      vnodeArgsTransformer = transformer;
6415
  }
6416
  const createVNodeWithArgsTransform = (...args) => {
6417
      return _createVNode(...(vnodeArgsTransformer
6418
          ? vnodeArgsTransformer(args, currentRenderingInstance)
6419
          : args));
6420
  };
6421
  const InternalObjectKey = `__vInternal`;
6422
  const normalizeKey = ({ key }) => key != null ? key : null;
6423
  const normalizeRef = ({ ref }) => {
6424
      return (ref != null
6425
          ? isString(ref) || isRef(ref) || isFunction(ref)
6426
              ? { i: currentRenderingInstance, r: ref }
6427
              : ref
6428
          : null);
6429
  };
6430
  const createVNode = ( createVNodeWithArgsTransform
6431
      );
6432
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
6433
      if (!type || type === NULL_DYNAMIC_COMPONENT) {
6434
          if ( !type) {
6435
              warn(`Invalid vnode type when creating vnode: ${type}.`);
6436
          }
6437
          type = Comment;
6438
      }
6439
      if (isVNode(type)) {
6440
          // createVNode receiving an existing vnode. This happens in cases like
6441
          // <component :is="vnode"/>
6442
          // #2078 make sure to merge refs during the clone instead of overwriting it
6443
          const cloned = cloneVNode(type, props, true /* mergeRef: true */);
6444
          if (children) {
6445
              normalizeChildren(cloned, children);
6446
          }
6447
          return cloned;
6448
      }
6449
      // class component normalization.
6450
      if (isClassComponent(type)) {
6451
          type = type.__vccOpts;
6452
      }
6453
      // class & style normalization.
6454
      if (props) {
6455
          // for reactive or proxy objects, we need to clone it to enable mutation.
6456
          if (isProxy(props) || InternalObjectKey in props) {
6457
              props = extend({}, props);
6458
          }
6459
          let { class: klass, style } = props;
6460
          if (klass && !isString(klass)) {
6461
              props.class = normalizeClass(klass);
6462
          }
6463
          if (isObject(style)) {
6464
              // reactive state objects need to be cloned since they are likely to be
6465
              // mutated
6466
              if (isProxy(style) && !isArray(style)) {
6467
                  style = extend({}, style);
6468
              }
6469
              props.style = normalizeStyle(style);
6470
          }
6471
      }
6472
      // encode the vnode type information into a bitmap
6473
      const shapeFlag = isString(type)
6474
          ? 1 /* ELEMENT */
6475
          :  isSuspense(type)
6476
              ? 128 /* SUSPENSE */
6477
              : isTeleport(type)
6478
                  ? 64 /* TELEPORT */
6479
                  : isObject(type)
6480
                      ? 4 /* STATEFUL_COMPONENT */
6481
                      : isFunction(type)
6482
                          ? 2 /* FUNCTIONAL_COMPONENT */
6483
                          : 0;
6484
      if ( shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
6485
          type = toRaw(type);
6486
          warn(`Vue received a Component which was made a reactive object. This can ` +
6487
              `lead to unnecessary performance overhead, and should be avoided by ` +
6488
              `marking the component with \`markRaw\` or using \`shallowRef\` ` +
6489
              `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
6490
      }
6491
      const vnode = {
6492
          __v_isVNode: true,
6493
          ["__v_skip" /* SKIP */]: true,
6494
          type,
6495
          props,
6496
          key: props && normalizeKey(props),
6497
          ref: props && normalizeRef(props),
6498
          scopeId: currentScopeId,
6499
          children: null,
6500
          component: null,
6501
          suspense: null,
6502
          ssContent: null,
6503
          ssFallback: null,
6504
          dirs: null,
6505
          transition: null,
6506
          el: null,
6507
          anchor: null,
6508
          target: null,
6509
          targetAnchor: null,
6510
          staticCount: 0,
6511
          shapeFlag,
6512
          patchFlag,
6513
          dynamicProps,
6514
          dynamicChildren: null,
6515
          appContext: null
6516
      };
6517
      // validate key
6518
      if ( vnode.key !== vnode.key) {
6519
          warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
6520
      }
6521
      normalizeChildren(vnode, children);
6522
      // normalize suspense children
6523
      if ( shapeFlag & 128 /* SUSPENSE */) {
6524
          const { content, fallback } = normalizeSuspenseChildren(vnode);
6525
          vnode.ssContent = content;
6526
          vnode.ssFallback = fallback;
6527
      }
6528
      if (shouldTrack$1 > 0 &&
6529
          // avoid a block node from tracking itself
6530
          !isBlockNode &&
6531
          // has current parent block
6532
          currentBlock &&
6533
          // presence of a patch flag indicates this node needs patching on updates.
6534
          // component nodes also should always be patched, because even if the
6535
          // component doesn't need to update, it needs to persist the instance on to
6536
          // the next vnode so that it can be properly unmounted later.
6537
          (patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
6538
          // the EVENTS flag is only for hydration and if it is the only flag, the
6539
          // vnode should not be considered dynamic due to handler caching.
6540
          patchFlag !== 32 /* HYDRATE_EVENTS */) {
6541
          currentBlock.push(vnode);
6542
      }
6543
      return vnode;
6544
  }
6545
  function cloneVNode(vnode, extraProps, mergeRef = false) {
6546
      // This is intentionally NOT using spread or extend to avoid the runtime
6547
      // key enumeration cost.
6548
      const { props, ref, patchFlag } = vnode;
6549
      const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
6550
      return {
6551
          __v_isVNode: true,
6552
          ["__v_skip" /* SKIP */]: true,
6553
          type: vnode.type,
6554
          props: mergedProps,
6555
          key: mergedProps && normalizeKey(mergedProps),
6556
          ref: extraProps && extraProps.ref
6557
              ? // #2078 in the case of <component :is="vnode" ref="extra"/>
6558
                  // if the vnode itself already has a ref, cloneVNode will need to merge
6559
                  // the refs so the single vnode can be set on multiple refs
6560
                  mergeRef && ref
6561
                      ? isArray(ref)
6562
                          ? ref.concat(normalizeRef(extraProps))
6563
                          : [ref, normalizeRef(extraProps)]
6564
                      : normalizeRef(extraProps)
6565
              : ref,
6566
          scopeId: vnode.scopeId,
6567
          children: vnode.children,
6568
          target: vnode.target,
6569
          targetAnchor: vnode.targetAnchor,
6570
          staticCount: vnode.staticCount,
6571
          shapeFlag: vnode.shapeFlag,
6572
          // if the vnode is cloned with extra props, we can no longer assume its
6573
          // existing patch flag to be reliable and need to add the FULL_PROPS flag.
6574
          // note: perserve flag for fragments since they use the flag for children
6575
          // fast paths only.
6576
          patchFlag: extraProps && vnode.type !== Fragment
6577
              ? patchFlag === -1 // hoisted node
6578
                  ? 16 /* FULL_PROPS */
6579
                  : patchFlag | 16 /* FULL_PROPS */
6580
              : patchFlag,
6581
          dynamicProps: vnode.dynamicProps,
6582
          dynamicChildren: vnode.dynamicChildren,
6583
          appContext: vnode.appContext,
6584
          dirs: vnode.dirs,
6585
          transition: vnode.transition,
6586
          // These should technically only be non-null on mounted VNodes. However,
6587
          // they *should* be copied for kept-alive vnodes. So we just always copy
6588
          // them since them being non-null during a mount doesn't affect the logic as
6589
          // they will simply be overwritten.
6590
          component: vnode.component,
6591
          suspense: vnode.suspense,
6592
          ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6593
          ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6594
          el: vnode.el,
6595
          anchor: vnode.anchor
6596
      };
6597
  }
6598
  /**
6599
   * @private
6600
   */
6601
  function createTextVNode(text = ' ', flag = 0) {
6602
      return createVNode(Text, null, text, flag);
6603
  }
6604
  /**
6605
   * @private
6606
   */
6607
  function createStaticVNode(content, numberOfNodes) {
6608
      // A static vnode can contain multiple stringified elements, and the number
6609
      // of elements is necessary for hydration.
6610
      const vnode = createVNode(Static, null, content);
6611
      vnode.staticCount = numberOfNodes;
6612
      return vnode;
6613
  }
6614
  /**
6615
   * @private
6616
   */
6617
  function createCommentVNode(text = '',
6618
  // when used as the v-else branch, the comment node must be created as a
6619
  // block to ensure correct updates.
6620
  asBlock = false) {
6621
      return asBlock
6622
          ? (openBlock(), createBlock(Comment, null, text))
6623
          : createVNode(Comment, null, text);
6624
  }
6625
  function normalizeVNode(child) {
6626
      if (child == null || typeof child === 'boolean') {
6627
          // empty placeholder
6628
          return createVNode(Comment);
6629
      }
6630
      else if (isArray(child)) {
6631
          // fragment
6632
          return createVNode(Fragment, null, child);
6633
      }
6634
      else if (typeof child === 'object') {
6635
          // already vnode, this should be the most common since compiled templates
6636
          // always produce all-vnode children arrays
6637
          return child.el === null ? child : cloneVNode(child);
6638
      }
6639
      else {
6640
          // strings and numbers
6641
          return createVNode(Text, null, String(child));
6642
      }
6643
  }
6644
  // optimized normalization for template-compiled render fns
6645
  function cloneIfMounted(child) {
6646
      return child.el === null ? child : cloneVNode(child);
6647
  }
6648
  function normalizeChildren(vnode, children) {
6649
      let type = 0;
6650
      const { shapeFlag } = vnode;
6651
      if (children == null) {
6652
          children = null;
6653
      }
6654
      else if (isArray(children)) {
6655
          type = 16 /* ARRAY_CHILDREN */;
6656
      }
6657
      else if (typeof children === 'object') {
6658
          if (shapeFlag & 1 /* ELEMENT */ || shapeFlag & 64 /* TELEPORT */) {
6659
              // Normalize slot to plain children for plain element and Teleport
6660
              const slot = children.default;
6661
              if (slot) {
6662
                  // _c marker is added by withCtx() indicating this is a compiled slot
6663
                  slot._c && setCompiledSlotRendering(1);
6664
                  normalizeChildren(vnode, slot());
6665
                  slot._c && setCompiledSlotRendering(-1);
6666
              }
6667
              return;
6668
          }
6669
          else {
6670
              type = 32 /* SLOTS_CHILDREN */;
6671
              const slotFlag = children._;
6672
              if (!slotFlag && !(InternalObjectKey in children)) {
6673
                  children._ctx = currentRenderingInstance;
6674
              }
6675
              else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
6676
                  // a child component receives forwarded slots from the parent.
6677
                  // its slot type is determined by its parent's slot type.
6678
                  if (currentRenderingInstance.vnode.patchFlag & 1024 /* DYNAMIC_SLOTS */) {
6679
                      children._ = 2 /* DYNAMIC */;
6680
                      vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
6681
                  }
6682
                  else {
6683
                      children._ = 1 /* STABLE */;
6684
                  }
6685
              }
6686
          }
6687
      }
6688
      else if (isFunction(children)) {
6689
          children = { default: children, _ctx: currentRenderingInstance };
6690
          type = 32 /* SLOTS_CHILDREN */;
6691
      }
6692
      else {
6693
          children = String(children);
6694
          // force teleport children to array so it can be moved around
6695
          if (shapeFlag & 64 /* TELEPORT */) {
6696
              type = 16 /* ARRAY_CHILDREN */;
6697
              children = [createTextVNode(children)];
6698
          }
6699
          else {
6700
              type = 8 /* TEXT_CHILDREN */;
6701
          }
6702
      }
6703
      vnode.children = children;
6704
      vnode.shapeFlag |= type;
6705
  }
6706
  function mergeProps(...args) {
6707
      const ret = extend({}, args[0]);
6708
      for (let i = 1; i < args.length; i++) {
6709
          const toMerge = args[i];
6710
          for (const key in toMerge) {
6711
              if (key === 'class') {
6712
                  if (ret.class !== toMerge.class) {
6713
                      ret.class = normalizeClass([ret.class, toMerge.class]);
6714
                  }
6715
              }
6716
              else if (key === 'style') {
6717
                  ret.style = normalizeStyle([ret.style, toMerge.style]);
6718
              }
6719
              else if (isOn(key)) {
6720
                  const existing = ret[key];
6721
                  const incoming = toMerge[key];
6722
                  if (existing !== incoming) {
6723
                      ret[key] = existing
6724
                          ? [].concat(existing, toMerge[key])
6725
                          : incoming;
6726
                  }
6727
              }
6728
              else if (key !== '') {
6729
                  ret[key] = toMerge[key];
6730
              }
6731
          }
6732
      }
6733
      return ret;
6734
  }
6735
 
6736
  function provide(key, value) {
6737
      if (!currentInstance) {
6738
          {
6739
              warn(`provide() can only be used inside setup().`);
6740
          }
6741
      }
6742
      else {
6743
          let provides = currentInstance.provides;
6744
          // by default an instance inherits its parent's provides object
6745
          // but when it needs to provide values of its own, it creates its
6746
          // own provides object using parent provides object as prototype.
6747
          // this way in `inject` we can simply look up injections from direct
6748
          // parent and let the prototype chain do the work.
6749
          const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6750
          if (parentProvides === provides) {
6751
              provides = currentInstance.provides = Object.create(parentProvides);
6752
          }
6753
          // TS doesn't allow symbol as index type
6754
          provides[key] = value;
6755
      }
6756
  }
6757
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6758
      // fallback to `currentRenderingInstance` so that this can be called in
6759
      // a functional component
6760
      const instance = currentInstance || currentRenderingInstance;
6761
      if (instance) {
6762
          // #2400
6763
          // to support `app.use` plugins,
6764
          // fallback to appContext's `provides` if the intance is at root
6765
          const provides = instance.parent == null
6766
              ? instance.vnode.appContext && instance.vnode.appContext.provides
6767
              : instance.parent.provides;
6768
          if (provides && key in provides) {
6769
              // TS doesn't allow symbol as index type
6770
              return provides[key];
6771
          }
6772
          else if (arguments.length > 1) {
6773
              return treatDefaultAsFactory && isFunction(defaultValue)
6774
                  ? defaultValue()
6775
                  : defaultValue;
6776
          }
6777
          else {
6778
              warn(`injection "${String(key)}" not found.`);
6779
          }
6780
      }
6781
      else {
6782
          warn(`inject() can only be used inside setup() or functional components.`);
6783
      }
6784
  }
6785
 
6786
  function createDuplicateChecker() {
6787
      const cache = Object.create(null);
6788
      return (type, key) => {
6789
          if (cache[key]) {
6790
              warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
6791
          }
6792
          else {
6793
              cache[key] = type;
6794
          }
6795
      };
6796
  }
6797
  let isInBeforeCreate = false;
6798
  function applyOptions(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
6799
      const {
6800
      // composition
6801
      mixins, extends: extendsOptions,
6802
      // state
6803
      data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
6804
      // assets
6805
      components, directives,
6806
      // lifecycle
6807
      beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured,
6808
      // public API
6809
      expose } = options;
6810
      const publicThis = instance.proxy;
6811
      const ctx = instance.ctx;
6812
      const globalMixins = instance.appContext.mixins;
6813
      if (asMixin && render && instance.render === NOOP) {
6814
          instance.render = render;
6815
      }
6816
      // applyOptions is called non-as-mixin once per instance
6817
      if (!asMixin) {
6818
          isInBeforeCreate = true;
6819
          callSyncHook('beforeCreate', "bc" /* BEFORE_CREATE */, options, instance, globalMixins);
6820
          isInBeforeCreate = false;
6821
          // global mixins are applied first
6822
          applyMixins(instance, globalMixins, deferredData, deferredWatch, deferredProvide);
6823
      }
6824
      // extending a base component...
6825
      if (extendsOptions) {
6826
          applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
6827
      }
6828
      // local mixins
6829
      if (mixins) {
6830
          applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide);
6831
      }
6832
      const checkDuplicateProperties =  createDuplicateChecker() ;
6833
      {
6834
          const [propsOptions] = instance.propsOptions;
6835
          if (propsOptions) {
6836
              for (const key in propsOptions) {
6837
                  checkDuplicateProperties("Props" /* PROPS */, key);
6838
              }
6839
          }
6840
      }
6841
      // options initialization order (to be consistent with Vue 2):
6842
      // - props (already done outside of this function)
6843
      // - inject
6844
      // - methods
6845
      // - data (deferred since it relies on `this` access)
6846
      // - computed
6847
      // - watch (deferred since it relies on `this` access)
6848
      if (injectOptions) {
6849
          if (isArray(injectOptions)) {
6850
              for (let i = 0; i < injectOptions.length; i++) {
6851
                  const key = injectOptions[i];
6852
                  ctx[key] = inject(key);
6853
                  {
6854
                      checkDuplicateProperties("Inject" /* INJECT */, key);
6855
                  }
6856
              }
6857
          }
6858
          else {
6859
              for (const key in injectOptions) {
6860
                  const opt = injectOptions[key];
6861
                  if (isObject(opt)) {
6862
                      ctx[key] = inject(opt.from || key, opt.default, true /* treat default function as factory */);
6863
                  }
6864
                  else {
6865
                      ctx[key] = inject(opt);
6866
                  }
6867
                  {
6868
                      checkDuplicateProperties("Inject" /* INJECT */, key);
6869
                  }
6870
              }
6871
          }
6872
      }
6873
      if (methods) {
6874
          for (const key in methods) {
6875
              const methodHandler = methods[key];
6876
              if (isFunction(methodHandler)) {
6877
                  ctx[key] = methodHandler.bind(publicThis);
6878
                  {
6879
                      checkDuplicateProperties("Methods" /* METHODS */, key);
6880
                  }
6881
              }
6882
              else {
6883
                  warn(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
6884
                      `Did you reference the function correctly?`);
6885
              }
6886
          }
6887
      }
6888
      if (!asMixin) {
6889
          if (deferredData.length) {
6890
              deferredData.forEach(dataFn => resolveData(instance, dataFn, publicThis));
6891
          }
6892
          if (dataOptions) {
6893
              // @ts-ignore dataOptions is not fully type safe
6894
              resolveData(instance, dataOptions, publicThis);
6895
          }
6896
          {
6897
              const rawData = toRaw(instance.data);
6898
              for (const key in rawData) {
6899
                  checkDuplicateProperties("Data" /* DATA */, key);
6900
                  // expose data on ctx during dev
6901
                  if (key[0] !== '$' && key[0] !== '_') {
6902
                      Object.defineProperty(ctx, key, {
6903
                          configurable: true,
6904
                          enumerable: true,
6905
                          get: () => rawData[key],
6906
                          set: NOOP
6907
                      });
6908
                  }
6909
              }
6910
          }
6911
      }
6912
      else if (dataOptions) {
6913
          deferredData.push(dataOptions);
6914
      }
6915
      if (computedOptions) {
6916
          for (const key in computedOptions) {
6917
              const opt = computedOptions[key];
6918
              const get = isFunction(opt)
6919
                  ? opt.bind(publicThis, publicThis)
6920
                  : isFunction(opt.get)
6921
                      ? opt.get.bind(publicThis, publicThis)
6922
                      : NOOP;
6923
              if ( get === NOOP) {
6924
                  warn(`Computed property "${key}" has no getter.`);
6925
              }
6926
              const set = !isFunction(opt) && isFunction(opt.set)
6927
                  ? opt.set.bind(publicThis)
6928
                  :  () => {
6929
                          warn(`Write operation failed: computed property "${key}" is readonly.`);
6930
                      }
6931
                      ;
6932
              const c = computed$1({
6933
                  get,
6934
                  set
6935
              });
6936
              Object.defineProperty(ctx, key, {
6937
                  enumerable: true,
6938
                  configurable: true,
6939
                  get: () => c.value,
6940
                  set: v => (c.value = v)
6941
              });
6942
              {
6943
                  checkDuplicateProperties("Computed" /* COMPUTED */, key);
6944
              }
6945
          }
6946
      }
6947
      if (watchOptions) {
6948
          deferredWatch.push(watchOptions);
6949
      }
6950
      if (!asMixin && deferredWatch.length) {
6951
          deferredWatch.forEach(watchOptions => {
6952
              for (const key in watchOptions) {
6953
                  createWatcher(watchOptions[key], ctx, publicThis, key);
6954
              }
6955
          });
6956
      }
6957
      if (provideOptions) {
6958
          deferredProvide.push(provideOptions);
6959
      }
6960
      if (!asMixin && deferredProvide.length) {
6961
          deferredProvide.forEach(provideOptions => {
6962
              const provides = isFunction(provideOptions)
6963
                  ? provideOptions.call(publicThis)
6964
                  : provideOptions;
6965
              Reflect.ownKeys(provides).forEach(key => {
6966
                  provide(key, provides[key]);
6967
              });
6968
          });
6969
      }
6970
      // asset options.
6971
      // To reduce memory usage, only components with mixins or extends will have
6972
      // resolved asset registry attached to instance.
6973
      if (asMixin) {
6974
          if (components) {
6975
              extend(instance.components ||
6976
                  (instance.components = extend({}, instance.type.components)), components);
6977
          }
6978
          if (directives) {
6979
              extend(instance.directives ||
6980
                  (instance.directives = extend({}, instance.type.directives)), directives);
6981
          }
6982
      }
6983
      // lifecycle options
6984
      if (!asMixin) {
6985
          callSyncHook('created', "c" /* CREATED */, options, instance, globalMixins);
6986
      }
6987
      if (beforeMount) {
6988
          onBeforeMount(beforeMount.bind(publicThis));
6989
      }
6990
      if (mounted) {
6991
          onMounted(mounted.bind(publicThis));
6992
      }
6993
      if (beforeUpdate) {
6994
          onBeforeUpdate(beforeUpdate.bind(publicThis));
6995
      }
6996
      if (updated) {
6997
          onUpdated(updated.bind(publicThis));
6998
      }
6999
      if (activated) {
7000
          onActivated(activated.bind(publicThis));
7001
      }
7002
      if (deactivated) {
7003
          onDeactivated(deactivated.bind(publicThis));
7004
      }
7005
      if (errorCaptured) {
7006
          onErrorCaptured(errorCaptured.bind(publicThis));
7007
      }
7008
      if (renderTracked) {
7009
          onRenderTracked(renderTracked.bind(publicThis));
7010
      }
7011
      if (renderTriggered) {
7012
          onRenderTriggered(renderTriggered.bind(publicThis));
7013
      }
7014
      if ( beforeDestroy) {
7015
          warn(`\`beforeDestroy\` has been renamed to \`beforeUnmount\`.`);
7016
      }
7017
      if (beforeUnmount) {
7018
          onBeforeUnmount(beforeUnmount.bind(publicThis));
7019
      }
7020
      if ( destroyed) {
7021
          warn(`\`destroyed\` has been renamed to \`unmounted\`.`);
7022
      }
7023
      if (unmounted) {
7024
          onUnmounted(unmounted.bind(publicThis));
7025
      }
7026
      if (isArray(expose)) {
7027
          if (!asMixin) {
7028
              if (expose.length) {
7029
                  const exposed = instance.exposed || (instance.exposed = proxyRefs({}));
7030
                  expose.forEach(key => {
7031
                      exposed[key] = toRef(publicThis, key);
7032
                  });
7033
              }
7034
              else if (!instance.exposed) {
7035
                  instance.exposed = EMPTY_OBJ;
7036
              }
7037
          }
7038
          else {
7039
              warn(`The \`expose\` option is ignored when used in mixins.`);
7040
          }
7041
      }
7042
  }
7043
  function callSyncHook(name, type, options, instance, globalMixins) {
7044
      callHookFromMixins(name, type, globalMixins, instance);
7045
      const { extends: base, mixins } = options;
7046
      if (base) {
7047
          callHookFromExtends(name, type, base, instance);
7048
      }
7049
      if (mixins) {
7050
          callHookFromMixins(name, type, mixins, instance);
7051
      }
7052
      const selfHook = options[name];
7053
      if (selfHook) {
7054
          callWithAsyncErrorHandling(selfHook.bind(instance.proxy), instance, type);
7055
      }
7056
  }
7057
  function callHookFromExtends(name, type, base, instance) {
7058
      if (base.extends) {
7059
          callHookFromExtends(name, type, base.extends, instance);
7060
      }
7061
      const baseHook = base[name];
7062
      if (baseHook) {
7063
          callWithAsyncErrorHandling(baseHook.bind(instance.proxy), instance, type);
7064
      }
7065
  }
7066
  function callHookFromMixins(name, type, mixins, instance) {
7067
      for (let i = 0; i < mixins.length; i++) {
7068
          const chainedMixins = mixins[i].mixins;
7069
          if (chainedMixins) {
7070
              callHookFromMixins(name, type, chainedMixins, instance);
7071
          }
7072
          const fn = mixins[i][name];
7073
          if (fn) {
7074
              callWithAsyncErrorHandling(fn.bind(instance.proxy), instance, type);
7075
          }
7076
      }
7077
  }
7078
  function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
7079
      for (let i = 0; i < mixins.length; i++) {
7080
          applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
7081
      }
7082
  }
7083
  function resolveData(instance, dataFn, publicThis) {
7084
      if ( !isFunction(dataFn)) {
7085
          warn(`The data option must be a function. ` +
7086
              `Plain object usage is no longer supported.`);
7087
      }
7088
      const data = dataFn.call(publicThis, publicThis);
7089
      if ( isPromise(data)) {
7090
          warn(`data() returned a Promise - note data() cannot be async; If you ` +
7091
              `intend to perform data fetching before component renders, use ` +
7092
              `async setup() + <Suspense>.`);
7093
      }
7094
      if (!isObject(data)) {
7095
           warn(`data() should return an object.`);
7096
      }
7097
      else if (instance.data === EMPTY_OBJ) {
7098
          instance.data = reactive(data);
7099
      }
7100
      else {
7101
          // existing data: this is a mixin or extends.
7102
          extend(instance.data, data);
7103
      }
7104
  }
7105
  function createWatcher(raw, ctx, publicThis, key) {
7106
      const getter = key.includes('.')
7107
          ? createPathGetter(publicThis, key)
7108
          : () => publicThis[key];
7109
      if (isString(raw)) {
7110
          const handler = ctx[raw];
7111
          if (isFunction(handler)) {
7112
              watch(getter, handler);
7113
          }
7114
          else {
7115
              warn(`Invalid watch handler specified by key "${raw}"`, handler);
7116
          }
7117
      }
7118
      else if (isFunction(raw)) {
7119
          watch(getter, raw.bind(publicThis));
7120
      }
7121
      else if (isObject(raw)) {
7122
          if (isArray(raw)) {
7123
              raw.forEach(r => createWatcher(r, ctx, publicThis, key));
7124
          }
7125
          else {
7126
              const handler = isFunction(raw.handler)
7127
                  ? raw.handler.bind(publicThis)
7128
                  : ctx[raw.handler];
7129
              if (isFunction(handler)) {
7130
                  watch(getter, handler, raw);
7131
              }
7132
              else {
7133
                  warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
7134
              }
7135
          }
7136
      }
7137
      else {
7138
          warn(`Invalid watch option: "${key}"`, raw);
7139
      }
7140
  }
7141
  function createPathGetter(ctx, path) {
7142
      const segments = path.split('.');
7143
      return () => {
7144
          let cur = ctx;
7145
          for (let i = 0; i < segments.length && cur; i++) {
7146
              cur = cur[segments[i]];
7147
          }
7148
          return cur;
7149
      };
7150
  }
7151
  function resolveMergedOptions(instance) {
7152
      const raw = instance.type;
7153
      const { __merged, mixins, extends: extendsOptions } = raw;
7154
      if (__merged)
7155
          return __merged;
7156
      const globalMixins = instance.appContext.mixins;
7157
      if (!globalMixins.length && !mixins && !extendsOptions)
7158
          return raw;
7159
      const options = {};
7160
      globalMixins.forEach(m => mergeOptions(options, m, instance));
7161
      mergeOptions(options, raw, instance);
7162
      return (raw.__merged = options);
7163
  }
7164
  function mergeOptions(to, from, instance) {
7165
      const strats = instance.appContext.config.optionMergeStrategies;
7166
      const { mixins, extends: extendsOptions } = from;
7167
      extendsOptions && mergeOptions(to, extendsOptions, instance);
7168
      mixins &&
7169
          mixins.forEach((m) => mergeOptions(to, m, instance));
7170
      for (const key in from) {
7171
          if (strats && hasOwn(strats, key)) {
7172
              to[key] = strats[key](to[key], from[key], instance.proxy, key);
7173
          }
7174
          else {
7175
              to[key] = from[key];
7176
          }
7177
      }
7178
  }
7179
 
7180
  /**
7181
   * #2437 In Vue 3, functional components do not have a public instance proxy but
7182
   * they exist in the internal parent chain. For code that relies on traversing
7183
   * public $parent chains, skip functional ones and go to the parent instead.
7184
   */
7185
  const getPublicInstance = (i) => i && (i.proxy ? i.proxy : getPublicInstance(i.parent));
7186
  const publicPropertiesMap = extend(Object.create(null), {
7187
      $: i => i,
7188
      $el: i => i.vnode.el,
7189
      $data: i => i.data,
7190
      $props: i => ( shallowReadonly(i.props) ),
7191
      $attrs: i => ( shallowReadonly(i.attrs) ),
7192
      $slots: i => ( shallowReadonly(i.slots) ),
7193
      $refs: i => ( shallowReadonly(i.refs) ),
7194
      $parent: i => getPublicInstance(i.parent),
7195
      $root: i => i.root && i.root.proxy,
7196
      $emit: i => i.emit,
7197
      $options: i => ( resolveMergedOptions(i) ),
7198
      $forceUpdate: i => () => queueJob(i.update),
7199
      $nextTick: i => nextTick.bind(i.proxy),
7200
      $watch: i => ( instanceWatch.bind(i) )
7201
  });
7202
  const PublicInstanceProxyHandlers = {
7203
      get({ _: instance }, key) {
7204
          const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
7205
          // let @vue/reactivity know it should never observe Vue public instances.
7206
          if (key === "__v_skip" /* SKIP */) {
7207
              return true;
7208
          }
7209
          // for internal formatters to know that this is a Vue instance
7210
          if ( key === '__isVue') {
7211
              return true;
7212
          }
7213
          // data / props / ctx
7214
          // This getter gets called for every property access on the render context
7215
          // during render and is a major hotspot. The most expensive part of this
7216
          // is the multiple hasOwn() calls. It's much faster to do a simple property
7217
          // access on a plain object, so we use an accessCache object (with null
7218
          // prototype) to memoize what access type a key corresponds to.
7219
          let normalizedProps;
7220
          if (key[0] !== '$') {
7221
              const n = accessCache[key];
7222
              if (n !== undefined) {
7223
                  switch (n) {
7224
                      case 0 /* SETUP */:
7225
                          return setupState[key];
7226
                      case 1 /* DATA */:
7227
                          return data[key];
7228
                      case 3 /* CONTEXT */:
7229
                          return ctx[key];
7230
                      case 2 /* PROPS */:
7231
                          return props[key];
7232
                      // default: just fallthrough
7233
                  }
7234
              }
7235
              else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
7236
                  accessCache[key] = 0 /* SETUP */;
7237
                  return setupState[key];
7238
              }
7239
              else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
7240
                  accessCache[key] = 1 /* DATA */;
7241
                  return data[key];
7242
              }
7243
              else if (
7244
              // only cache other properties when instance has declared (thus stable)
7245
              // props
7246
              (normalizedProps = instance.propsOptions[0]) &&
7247
                  hasOwn(normalizedProps, key)) {
7248
                  accessCache[key] = 2 /* PROPS */;
7249
                  return props[key];
7250
              }
7251
              else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7252
                  accessCache[key] = 3 /* CONTEXT */;
7253
                  return ctx[key];
7254
              }
7255
              else if ( !isInBeforeCreate) {
7256
                  accessCache[key] = 4 /* OTHER */;
7257
              }
7258
          }
7259
          const publicGetter = publicPropertiesMap[key];
7260
          let cssModule, globalProperties;
7261
          // public $xxx properties
7262
          if (publicGetter) {
7263
              if (key === '$attrs') {
7264
                  track(instance, "get" /* GET */, key);
7265
                   markAttrsAccessed();
7266
              }
7267
              return publicGetter(instance);
7268
          }
7269
          else if (
7270
          // css module (injected by vue-loader)
7271
          (cssModule = type.__cssModules) &&
7272
              (cssModule = cssModule[key])) {
7273
              return cssModule;
7274
          }
7275
          else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7276
              // user may set custom properties to `this` that start with `$`
7277
              accessCache[key] = 3 /* CONTEXT */;
7278
              return ctx[key];
7279
          }
7280
          else if (
7281
          // global properties
7282
          ((globalProperties = appContext.config.globalProperties),
7283
              hasOwn(globalProperties, key))) {
7284
              return globalProperties[key];
7285
          }
7286
          else if (
7287
              currentRenderingInstance &&
7288
              (!isString(key) ||
7289
                  // #1091 avoid internal isRef/isVNode checks on component instance leading
7290
                  // to infinite warning loop
7291
                  key.indexOf('__v') !== 0)) {
7292
              if (data !== EMPTY_OBJ &&
7293
                  (key[0] === '$' || key[0] === '_') &&
7294
                  hasOwn(data, key)) {
7295
                  warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
7296
                      `character ("$" or "_") and is not proxied on the render context.`);
7297
              }
7298
              else {
7299
                  warn(`Property ${JSON.stringify(key)} was accessed during render ` +
7300
                      `but is not defined on instance.`);
7301
              }
7302
          }
7303
      },
7304
      set({ _: instance }, key, value) {
7305
          const { data, setupState, ctx } = instance;
7306
          if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
7307
              setupState[key] = value;
7308
          }
7309
          else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
7310
              data[key] = value;
7311
          }
7312
          else if (key in instance.props) {
7313
 
7314
                  warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
7315
              return false;
7316
          }
7317
          if (key[0] === '$' && key.slice(1) in instance) {
7318
 
7319
                  warn(`Attempting to mutate public property "${key}". ` +
7320
                      `Properties starting with $ are reserved and readonly.`, instance);
7321
              return false;
7322
          }
7323
          else {
7324
              if ( key in instance.appContext.config.globalProperties) {
7325
                  Object.defineProperty(ctx, key, {
7326
                      enumerable: true,
7327
                      configurable: true,
7328
                      value
7329
                  });
7330
              }
7331
              else {
7332
                  ctx[key] = value;
7333
              }
7334
          }
7335
          return true;
7336
      },
7337
      has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
7338
          let normalizedProps;
7339
          return (accessCache[key] !== undefined ||
7340
              (data !== EMPTY_OBJ && hasOwn(data, key)) ||
7341
              (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
7342
              ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
7343
              hasOwn(ctx, key) ||
7344
              hasOwn(publicPropertiesMap, key) ||
7345
              hasOwn(appContext.config.globalProperties, key));
7346
      }
7347
  };
7348
  {
7349
      PublicInstanceProxyHandlers.ownKeys = (target) => {
7350
          warn(`Avoid app logic that relies on enumerating keys on a component instance. ` +
7351
              `The keys will be empty in production mode to avoid performance overhead.`);
7352
          return Reflect.ownKeys(target);
7353
      };
7354
  }
7355
  const RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, {
7356
      get(target, key) {
7357
          // fast path for unscopables when using `with` block
7358
          if (key === Symbol.unscopables) {
7359
              return;
7360
          }
7361
          return PublicInstanceProxyHandlers.get(target, key, target);
7362
      },
7363
      has(_, key) {
7364
          const has = key[0] !== '_' && !isGloballyWhitelisted(key);
7365
          if ( !has && PublicInstanceProxyHandlers.has(_, key)) {
7366
              warn(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
7367
          }
7368
          return has;
7369
      }
7370
  });
7371
  // In dev mode, the proxy target exposes the same properties as seen on `this`
7372
  // for easier console inspection. In prod mode it will be an empty object so
7373
  // these properties definitions can be skipped.
7374
  function createRenderContext(instance) {
7375
      const target = {};
7376
      // expose internal instance for proxy handlers
7377
      Object.defineProperty(target, `_`, {
7378
          configurable: true,
7379
          enumerable: false,
7380
          get: () => instance
7381
      });
7382
      // expose public properties
7383
      Object.keys(publicPropertiesMap).forEach(key => {
7384
          Object.defineProperty(target, key, {
7385
              configurable: true,
7386
              enumerable: false,
7387
              get: () => publicPropertiesMap[key](instance),
7388
              // intercepted by the proxy so no need for implementation,
7389
              // but needed to prevent set errors
7390
              set: NOOP
7391
          });
7392
      });
7393
      // expose global properties
7394
      const { globalProperties } = instance.appContext.config;
7395
      Object.keys(globalProperties).forEach(key => {
7396
          Object.defineProperty(target, key, {
7397
              configurable: true,
7398
              enumerable: false,
7399
              get: () => globalProperties[key],
7400
              set: NOOP
7401
          });
7402
      });
7403
      return target;
7404
  }
7405
  // dev only
7406
  function exposePropsOnRenderContext(instance) {
7407
      const { ctx, propsOptions: [propsOptions] } = instance;
7408
      if (propsOptions) {
7409
          Object.keys(propsOptions).forEach(key => {
7410
              Object.defineProperty(ctx, key, {
7411
                  enumerable: true,
7412
                  configurable: true,
7413
                  get: () => instance.props[key],
7414
                  set: NOOP
7415
              });
7416
          });
7417
      }
7418
  }
7419
  // dev only
7420
  function exposeSetupStateOnRenderContext(instance) {
7421
      const { ctx, setupState } = instance;
7422
      Object.keys(toRaw(setupState)).forEach(key => {
7423
          if (key[0] === '$' || key[0] === '_') {
7424
              warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
7425
                  `which are reserved prefixes for Vue internals.`);
7426
              return;
7427
          }
7428
          Object.defineProperty(ctx, key, {
7429
              enumerable: true,
7430
              configurable: true,
7431
              get: () => setupState[key],
7432
              set: NOOP
7433
          });
7434
      });
7435
  }
7436
 
7437
  const emptyAppContext = createAppContext();
7438
  let uid$2 = 0;
7439
  function createComponentInstance(vnode, parent, suspense) {
7440
      const type = vnode.type;
7441
      // inherit parent app context - or - if root, adopt from root vnode
7442
      const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
7443
      const instance = {
7444
          uid: uid$2++,
7445
          vnode,
7446
          type,
7447
          parent,
7448
          appContext,
7449
          root: null,
7450
          next: null,
7451
          subTree: null,
7452
          update: null,
7453
          render: null,
7454
          proxy: null,
7455
          exposed: null,
7456
          withProxy: null,
7457
          effects: null,
7458
          provides: parent ? parent.provides : Object.create(appContext.provides),
7459
          accessCache: null,
7460
          renderCache: [],
7461
          // local resovled assets
7462
          components: null,
7463
          directives: null,
7464
          // resolved props and emits options
7465
          propsOptions: normalizePropsOptions(type, appContext),
7466
          emitsOptions: normalizeEmitsOptions(type, appContext),
7467
          // emit
7468
          emit: null,
7469
          emitted: null,
7470
          // state
7471
          ctx: EMPTY_OBJ,
7472
          data: EMPTY_OBJ,
7473
          props: EMPTY_OBJ,
7474
          attrs: EMPTY_OBJ,
7475
          slots: EMPTY_OBJ,
7476
          refs: EMPTY_OBJ,
7477
          setupState: EMPTY_OBJ,
7478
          setupContext: null,
7479
          // suspense related
7480
          suspense,
7481
          suspenseId: suspense ? suspense.pendingId : 0,
7482
          asyncDep: null,
7483
          asyncResolved: false,
7484
          // lifecycle hooks
7485
          // not using enums here because it results in computed properties
7486
          isMounted: false,
7487
          isUnmounted: false,
7488
          isDeactivated: false,
7489
          bc: null,
7490
          c: null,
7491
          bm: null,
7492
          m: null,
7493
          bu: null,
7494
          u: null,
7495
          um: null,
7496
          bum: null,
7497
          da: null,
7498
          a: null,
7499
          rtg: null,
7500
          rtc: null,
7501
          ec: null
7502
      };
7503
      {
7504
          instance.ctx = createRenderContext(instance);
7505
      }
7506
      instance.root = parent ? parent.root : instance;
7507
      instance.emit = emit.bind(null, instance);
7508
      {
7509
          devtoolsComponentAdded(instance);
7510
      }
7511
      return instance;
7512
  }
7513
  let currentInstance = null;
7514
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
7515
  const setCurrentInstance = (instance) => {
7516
      currentInstance = instance;
7517
  };
7518
  const isBuiltInTag = /*#__PURE__*/ makeMap('slot,component');
7519
  function validateComponentName(name, config) {
7520
      const appIsNativeTag = config.isNativeTag || NO;
7521
      if (isBuiltInTag(name) || appIsNativeTag(name)) {
7522
          warn('Do not use built-in or reserved HTML elements as component id: ' + name);
7523
      }
7524
  }
7525
  let isInSSRComponentSetup = false;
7526
  function setupComponent(instance, isSSR = false) {
7527
      isInSSRComponentSetup = isSSR;
7528
      const { props, children, shapeFlag } = instance.vnode;
7529
      const isStateful = shapeFlag & 4 /* STATEFUL_COMPONENT */;
7530
      initProps(instance, props, isStateful, isSSR);
7531
      initSlots(instance, children);
7532
      const setupResult = isStateful
7533
          ? setupStatefulComponent(instance, isSSR)
7534
          : undefined;
7535
      isInSSRComponentSetup = false;
7536
      return setupResult;
7537
  }
7538
  function setupStatefulComponent(instance, isSSR) {
7539
      const Component = instance.type;
7540
      {
7541
          if (Component.name) {
7542
              validateComponentName(Component.name, instance.appContext.config);
7543
          }
7544
          if (Component.components) {
7545
              const names = Object.keys(Component.components);
7546
              for (let i = 0; i < names.length; i++) {
7547
                  validateComponentName(names[i], instance.appContext.config);
7548
              }
7549
          }
7550
          if (Component.directives) {
7551
              const names = Object.keys(Component.directives);
7552
              for (let i = 0; i < names.length; i++) {
7553
                  validateDirectiveName(names[i]);
7554
              }
7555
          }
7556
      }
7557
      // 0. create render proxy property access cache
7558
      instance.accessCache = Object.create(null);
7559
      // 1. create public instance / render proxy
7560
      // also mark it raw so it's never observed
7561
      instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
7562
      {
7563
          exposePropsOnRenderContext(instance);
7564
      }
7565
      // 2. call setup()
7566
      const { setup } = Component;
7567
      if (setup) {
7568
          const setupContext = (instance.setupContext =
7569
              setup.length > 1 ? createSetupContext(instance) : null);
7570
          currentInstance = instance;
7571
          pauseTracking();
7572
          const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [ shallowReadonly(instance.props) , setupContext]);
7573
          resetTracking();
7574
          currentInstance = null;
7575
          if (isPromise(setupResult)) {
7576
              if (isSSR) {
7577
                  // return the promise so server-renderer can wait on it
7578
                  return setupResult.then((resolvedResult) => {
7579
                      handleSetupResult(instance, resolvedResult);
7580
                  });
7581
              }
7582
              else {
7583
                  // async setup returned Promise.
7584
                  // bail here and wait for re-entry.
7585
                  instance.asyncDep = setupResult;
7586
              }
7587
          }
7588
          else {
7589
              handleSetupResult(instance, setupResult);
7590
          }
7591
      }
7592
      else {
7593
          finishComponentSetup(instance);
7594
      }
7595
  }
7596
  function handleSetupResult(instance, setupResult, isSSR) {
7597
      if (isFunction(setupResult)) {
7598
          // setup returned an inline render function
7599
          {
7600
              instance.render = setupResult;
7601
          }
7602
      }
7603
      else if (isObject(setupResult)) {
7604
          if ( isVNode(setupResult)) {
7605
              warn(`setup() should not return VNodes directly - ` +
7606
                  `return a render function instead.`);
7607
          }
7608
          // setup returned bindings.
7609
          // assuming a render function compiled from template is present.
7610
          {
7611
              instance.devtoolsRawSetupState = setupResult;
7612
          }
7613
          instance.setupState = proxyRefs(setupResult);
7614
          {
7615
              exposeSetupStateOnRenderContext(instance);
7616
          }
7617
      }
7618
      else if ( setupResult !== undefined) {
7619
          warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`);
7620
      }
7621
      finishComponentSetup(instance);
7622
  }
7623
  let compile;
7624
  /**
7625
   * For runtime-dom to register the compiler.
7626
   * Note the exported method uses any to avoid d.ts relying on the compiler types.
7627
   */
7628
  function registerRuntimeCompiler(_compile) {
7629
      compile = _compile;
7630
  }
7631
  function finishComponentSetup(instance, isSSR) {
7632
      const Component = instance.type;
7633
      // template / render function normalization
7634
      if (!instance.render) {
7635
          // could be set from setup()
7636
          if (compile && Component.template && !Component.render) {
7637
              {
7638
                  startMeasure(instance, `compile`);
7639
              }
7640
              Component.render = compile(Component.template, {
7641
                  isCustomElement: instance.appContext.config.isCustomElement,
7642
                  delimiters: Component.delimiters
7643
              });
7644
              {
7645
                  endMeasure(instance, `compile`);
7646
              }
7647
          }
7648
          instance.render = (Component.render || NOOP);
7649
          // for runtime-compiled render functions using `with` blocks, the render
7650
          // proxy used needs a different `has` handler which is more performant and
7651
          // also only allows a whitelist of globals to fallthrough.
7652
          if (instance.render._rc) {
7653
              instance.withProxy = new Proxy(instance.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
7654
          }
7655
      }
7656
      // support for 2.x options
7657
      {
7658
          currentInstance = instance;
7659
          pauseTracking();
7660
          applyOptions(instance, Component);
7661
          resetTracking();
7662
          currentInstance = null;
7663
      }
7664
      // warn missing template/render
7665
      if ( !Component.render && instance.render === NOOP) {
7666
          /* istanbul ignore if */
7667
          if (!compile && Component.template) {
7668
              warn(`Component provided template option but ` +
7669
                  `runtime compilation is not supported in this build of Vue.` +
7670
                  (   ` Use "vue.global.js" instead.`
7671
                              ) /* should not happen */);
7672
          }
7673
          else {
7674
              warn(`Component is missing template or render function.`);
7675
          }
7676
      }
7677
  }
7678
  const attrHandlers = {
7679
      get: (target, key) => {
7680
          {
7681
              markAttrsAccessed();
7682
          }
7683
          return target[key];
7684
      },
7685
      set: () => {
7686
          warn(`setupContext.attrs is readonly.`);
7687
          return false;
7688
      },
7689
      deleteProperty: () => {
7690
          warn(`setupContext.attrs is readonly.`);
7691
          return false;
7692
      }
7693
  };
7694
  function createSetupContext(instance) {
7695
      const expose = exposed => {
7696
          if ( instance.exposed) {
7697
              warn(`expose() should be called only once per setup().`);
7698
          }
7699
          instance.exposed = proxyRefs(exposed);
7700
      };
7701
      {
7702
          // We use getters in dev in case libs like test-utils overwrite instance
7703
          // properties (overwrites should not be done in prod)
7704
          return Object.freeze({
7705
              get props() {
7706
                  return instance.props;
7707
              },
7708
              get attrs() {
7709
                  return new Proxy(instance.attrs, attrHandlers);
7710
              },
7711
              get slots() {
7712
                  return shallowReadonly(instance.slots);
7713
              },
7714
              get emit() {
7715
                  return (event, ...args) => instance.emit(event, ...args);
7716
              },
7717
              expose
7718
          });
7719
      }
7720
  }
7721
  // record effects created during a component's setup() so that they can be
7722
  // stopped when the component unmounts
7723
  function recordInstanceBoundEffect(effect, instance = currentInstance) {
7724
      if (instance) {
7725
          (instance.effects || (instance.effects = [])).push(effect);
7726
      }
7727
  }
7728
  const classifyRE = /(?:^|[-_])(\w)/g;
7729
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
7730
  function getComponentName(Component) {
7731
      return isFunction(Component)
7732
          ? Component.displayName || Component.name
7733
          : Component.name;
7734
  }
7735
  /* istanbul ignore next */
7736
  function formatComponentName(instance, Component, isRoot = false) {
7737
      let name = getComponentName(Component);
7738
      if (!name && Component.__file) {
7739
          const match = Component.__file.match(/([^/\\]+)\.\w+$/);
7740
          if (match) {
7741
              name = match[1];
7742
          }
7743
      }
7744
      if (!name && instance && instance.parent) {
7745
          // try to infer the name based on reverse resolution
7746
          const inferFromRegistry = (registry) => {
7747
              for (const key in registry) {
7748
                  if (registry[key] === Component) {
7749
                      return key;
7750
                  }
7751
              }
7752
          };
7753
          name =
7754
              inferFromRegistry(instance.components ||
7755
                  instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
7756
      }
7757
      return name ? classify(name) : isRoot ? `App` : `Anonymous`;
7758
  }
7759
  function isClassComponent(value) {
7760
      return isFunction(value) && '__vccOpts' in value;
7761
  }
7762
 
7763
  function computed$1(getterOrOptions) {
7764
      const c = computed(getterOrOptions);
7765
      recordInstanceBoundEffect(c.effect);
7766
      return c;
7767
  }
7768
 
7769
  // implementation
7770
  function defineProps() {
7771
      {
7772
          warn(`defineProps() is a compiler-hint helper that is only usable inside ` +
7773
              `<script setup> of a single file component. Its arguments should be ` +
7774
              `compiled away and passing it at runtime has no effect.`);
7775
      }
7776
      return null;
7777
  }
7778
  // implementation
7779
  function defineEmit() {
7780
      {
7781
          warn(`defineEmit() is a compiler-hint helper that is only usable inside ` +
7782
              `<script setup> of a single file component. Its arguments should be ` +
7783
              `compiled away and passing it at runtime has no effect.`);
7784
      }
7785
      return null;
7786
  }
7787
  function useContext() {
7788
      const i = getCurrentInstance();
7789
      if ( !i) {
7790
          warn(`useContext() called without active instance.`);
7791
      }
7792
      return i.setupContext || (i.setupContext = createSetupContext(i));
7793
  }
7794
 
7795
  // Actual implementation
7796
  function h(type, propsOrChildren, children) {
7797
      const l = arguments.length;
7798
      if (l === 2) {
7799
          if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
7800
              // single vnode without props
7801
              if (isVNode(propsOrChildren)) {
7802
                  return createVNode(type, null, [propsOrChildren]);
7803
              }
7804
              // props without children
7805
              return createVNode(type, propsOrChildren);
7806
          }
7807
          else {
7808
              // omit props
7809
              return createVNode(type, null, propsOrChildren);
7810
          }
7811
      }
7812
      else {
7813
          if (l > 3) {
7814
              children = Array.prototype.slice.call(arguments, 2);
7815
          }
7816
          else if (l === 3 && isVNode(children)) {
7817
              children = [children];
7818
          }
7819
          return createVNode(type, propsOrChildren, children);
7820
      }
7821
  }
7822
 
7823
  const ssrContextKey = Symbol( `ssrContext` );
7824
  const useSSRContext = () => {
7825
      {
7826
          warn(`useSsrContext() is not supported in the global build.`);
7827
      }
7828
  };
7829
 
7830
  function initCustomFormatter() {
7831
      /* eslint-disable no-restricted-globals */
7832
      if ( typeof window === 'undefined') {
7833
          return;
7834
      }
7835
      const vueStyle = { style: 'color:#3ba776' };
7836
      const numberStyle = { style: 'color:#0b1bc9' };
7837
      const stringStyle = { style: 'color:#b62e24' };
7838
      const keywordStyle = { style: 'color:#9d288c' };
7839
      // custom formatter for Chrome
7840
      // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
7841
      const formatter = {
7842
          header(obj) {
7843
              // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
7844
              if (!isObject(obj)) {
7845
                  return null;
7846
              }
7847
              if (obj.__isVue) {
7848
                  return ['div', vueStyle, `VueInstance`];
7849
              }
7850
              else if (isRef(obj)) {
7851
                  return [
7852
                      'div',
7853
                      {},
7854
                      ['span', vueStyle, genRefFlag(obj)],
7855
                      '<',
7856
                      formatValue(obj.value),
7857
                      `>`
7858
                  ];
7859
              }
7860
              else if (isReactive(obj)) {
7861
                  return [
7862
                      'div',
7863
                      {},
7864
                      ['span', vueStyle, 'Reactive'],
7865
                      '<',
7866
                      formatValue(obj),
7867
                      `>${isReadonly(obj) ? ` (readonly)` : ``}`
7868
                  ];
7869
              }
7870
              else if (isReadonly(obj)) {
7871
                  return [
7872
                      'div',
7873
                      {},
7874
                      ['span', vueStyle, 'Readonly'],
7875
                      '<',
7876
                      formatValue(obj),
7877
                      '>'
7878
                  ];
7879
              }
7880
              return null;
7881
          },
7882
          hasBody(obj) {
7883
              return obj && obj.__isVue;
7884
          },
7885
          body(obj) {
7886
              if (obj && obj.__isVue) {
7887
                  return [
7888
                      'div',
7889
                      {},
7890
                      ...formatInstance(obj.$)
7891
                  ];
7892
              }
7893
          }
7894
      };
7895
      function formatInstance(instance) {
7896
          const blocks = [];
7897
          if (instance.type.props && instance.props) {
7898
              blocks.push(createInstanceBlock('props', toRaw(instance.props)));
7899
          }
7900
          if (instance.setupState !== EMPTY_OBJ) {
7901
              blocks.push(createInstanceBlock('setup', instance.setupState));
7902
          }
7903
          if (instance.data !== EMPTY_OBJ) {
7904
              blocks.push(createInstanceBlock('data', toRaw(instance.data)));
7905
          }
7906
          const computed = extractKeys(instance, 'computed');
7907
          if (computed) {
7908
              blocks.push(createInstanceBlock('computed', computed));
7909
          }
7910
          const injected = extractKeys(instance, 'inject');
7911
          if (injected) {
7912
              blocks.push(createInstanceBlock('injected', injected));
7913
          }
7914
          blocks.push([
7915
              'div',
7916
              {},
7917
              [
7918
                  'span',
7919
                  {
7920
                      style: keywordStyle.style + ';opacity:0.66'
7921
                  },
7922
                  '$ (internal): '
7923
              ],
7924
              ['object', { object: instance }]
7925
          ]);
7926
          return blocks;
7927
      }
7928
      function createInstanceBlock(type, target) {
7929
          target = extend({}, target);
7930
          if (!Object.keys(target).length) {
7931
              return ['span', {}];
7932
          }
7933
          return [
7934
              'div',
7935
              { style: 'line-height:1.25em;margin-bottom:0.6em' },
7936
              [
7937
                  'div',
7938
                  {
7939
                      style: 'color:#476582'
7940
                  },
7941
                  type
7942
              ],
7943
              [
7944
                  'div',
7945
                  {
7946
                      style: 'padding-left:1.25em'
7947
                  },
7948
                  ...Object.keys(target).map(key => {
7949
                      return [
7950
                          'div',
7951
                          {},
7952
                          ['span', keywordStyle, key + ': '],
7953
                          formatValue(target[key], false)
7954
                      ];
7955
                  })
7956
              ]
7957
          ];
7958
      }
7959
      function formatValue(v, asRaw = true) {
7960
          if (typeof v === 'number') {
7961
              return ['span', numberStyle, v];
7962
          }
7963
          else if (typeof v === 'string') {
7964
              return ['span', stringStyle, JSON.stringify(v)];
7965
          }
7966
          else if (typeof v === 'boolean') {
7967
              return ['span', keywordStyle, v];
7968
          }
7969
          else if (isObject(v)) {
7970
              return ['object', { object: asRaw ? toRaw(v) : v }];
7971
          }
7972
          else {
7973
              return ['span', stringStyle, String(v)];
7974
          }
7975
      }
7976
      function extractKeys(instance, type) {
7977
          const Comp = instance.type;
7978
          if (isFunction(Comp)) {
7979
              return;
7980
          }
7981
          const extracted = {};
7982
          for (const key in instance.ctx) {
7983
              if (isKeyOfType(Comp, key, type)) {
7984
                  extracted[key] = instance.ctx[key];
7985
              }
7986
          }
7987
          return extracted;
7988
      }
7989
      function isKeyOfType(Comp, key, type) {
7990
          const opts = Comp[type];
7991
          if ((isArray(opts) && opts.includes(key)) ||
7992
              (isObject(opts) && key in opts)) {
7993
              return true;
7994
          }
7995
          if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
7996
              return true;
7997
          }
7998
          if (Comp.mixins && Comp.mixins.some(m => isKeyOfType(m, key, type))) {
7999
              return true;
8000
          }
8001
      }
8002
      function genRefFlag(v) {
8003
          if (v._shallow) {
8004
              return `ShallowRef`;
8005
          }
8006
          if (v.effect) {
8007
              return `ComputedRef`;
8008
          }
8009
          return `Ref`;
8010
      }
8011
      if (window.devtoolsFormatters) {
8012
          window.devtoolsFormatters.push(formatter);
8013
      }
8014
      else {
8015
          window.devtoolsFormatters = [formatter];
8016
      }
8017
  }
8018
 
8019
  /**
8020
   * Actual implementation
8021
   */
8022
  function renderList(source, renderItem) {
8023
      let ret;
8024
      if (isArray(source) || isString(source)) {
8025
          ret = new Array(source.length);
8026
          for (let i = 0, l = source.length; i < l; i++) {
8027
              ret[i] = renderItem(source[i], i);
8028
          }
8029
      }
8030
      else if (typeof source === 'number') {
8031
          if ( !Number.isInteger(source)) {
8032
              warn(`The v-for range expect an integer value but got ${source}.`);
8033
              return [];
8034
          }
8035
          ret = new Array(source);
8036
          for (let i = 0; i < source; i++) {
8037
              ret[i] = renderItem(i + 1, i);
8038
          }
8039
      }
8040
      else if (isObject(source)) {
8041
          if (source[Symbol.iterator]) {
8042
              ret = Array.from(source, renderItem);
8043
          }
8044
          else {
8045
              const keys = Object.keys(source);
8046
              ret = new Array(keys.length);
8047
              for (let i = 0, l = keys.length; i < l; i++) {
8048
                  const key = keys[i];
8049
                  ret[i] = renderItem(source[key], key, i);
8050
              }
8051
          }
8052
      }
8053
      else {
8054
          ret = [];
8055
      }
8056
      return ret;
8057
  }
8058
 
8059
  /**
8060
   * For prefixing keys in v-on="obj" with "on"
8061
   * @private
8062
   */
8063
  function toHandlers(obj) {
8064
      const ret = {};
8065
      if ( !isObject(obj)) {
8066
          warn(`v-on with no argument expects an object value.`);
8067
          return ret;
8068
      }
8069
      for (const key in obj) {
8070
          ret[toHandlerKey(key)] = obj[key];
8071
      }
8072
      return ret;
8073
  }
8074
 
8075
  /**
8076
   * Compiler runtime helper for creating dynamic slots object
8077
   * @private
8078
   */
8079
  function createSlots(slots, dynamicSlots) {
8080
      for (let i = 0; i < dynamicSlots.length; i++) {
8081
          const slot = dynamicSlots[i];
8082
          // array of dynamic slot generated by <template v-for="..." #[...]>
8083
          if (isArray(slot)) {
8084
              for (let j = 0; j < slot.length; j++) {
8085
                  slots[slot[j].name] = slot[j].fn;
8086
              }
8087
          }
8088
          else if (slot) {
8089
              // conditional single slot generated by <template v-if="..." #foo>
8090
              slots[slot.name] = slot.fn;
8091
          }
8092
      }
8093
      return slots;
8094
  }
8095
 
8096
  // Core API ------------------------------------------------------------------
8097
  const version = "3.0.5";
8098
  /**
8099
   * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8100
   * @internal
8101
   */
8102
  const ssrUtils = ( null);
8103
 
8104
  const svgNS = 'http://www.w3.org/2000/svg';
8105
  const doc = (typeof document !== 'undefined' ? document : null);
8106
  let tempContainer;
8107
  let tempSVGContainer;
8108
  const nodeOps = {
8109
      insert: (child, parent, anchor) => {
8110
          parent.insertBefore(child, anchor || null);
8111
      },
8112
      remove: child => {
8113
          const parent = child.parentNode;
8114
          if (parent) {
8115
              parent.removeChild(child);
8116
          }
8117
      },
8118
      createElement: (tag, isSVG, is) => isSVG
8119
          ? doc.createElementNS(svgNS, tag)
8120
          : doc.createElement(tag, is ? { is } : undefined),
8121
      createText: text => doc.createTextNode(text),
8122
      createComment: text => doc.createComment(text),
8123
      setText: (node, text) => {
8124
          node.nodeValue = text;
8125
      },
8126
      setElementText: (el, text) => {
8127
          el.textContent = text;
8128
      },
8129
      parentNode: node => node.parentNode,
8130
      nextSibling: node => node.nextSibling,
8131
      querySelector: selector => doc.querySelector(selector),
8132
      setScopeId(el, id) {
8133
          el.setAttribute(id, '');
8134
      },
8135
      cloneNode(el) {
8136
          return el.cloneNode(true);
8137
      },
8138
      // __UNSAFE__
8139
      // Reason: innerHTML.
8140
      // Static content here can only come from compiled templates.
8141
      // As long as the user only uses trusted templates, this is safe.
8142
      insertStaticContent(content, parent, anchor, isSVG) {
8143
          const temp = isSVG
8144
              ? tempSVGContainer ||
8145
                  (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
8146
              : tempContainer || (tempContainer = doc.createElement('div'));
8147
          temp.innerHTML = content;
8148
          const first = temp.firstChild;
8149
          let node = first;
8150
          let last = node;
8151
          while (node) {
8152
              last = node;
8153
              nodeOps.insert(node, parent, anchor);
8154
              node = temp.firstChild;
8155
          }
8156
          return [first, last];
8157
      }
8158
  };
8159
 
8160
  // compiler should normalize class + :class bindings on the same element
8161
  // into a single binding ['staticClass', dynamic]
8162
  function patchClass(el, value, isSVG) {
8163
      if (value == null) {
8164
          value = '';
8165
      }
8166
      if (isSVG) {
8167
          el.setAttribute('class', value);
8168
      }
8169
      else {
8170
          // directly setting className should be faster than setAttribute in theory
8171
          // if this is an element during a transition, take the temporary transition
8172
          // classes into account.
8173
          const transitionClasses = el._vtc;
8174
          if (transitionClasses) {
8175
              value = (value
8176
                  ? [value, ...transitionClasses]
8177
                  : [...transitionClasses]).join(' ');
8178
          }
8179
          el.className = value;
8180
      }
8181
  }
8182
 
8183
  function patchStyle(el, prev, next) {
8184
      const style = el.style;
8185
      if (!next) {
8186
          el.removeAttribute('style');
8187
      }
8188
      else if (isString(next)) {
8189
          if (prev !== next) {
8190
              style.cssText = next;
8191
          }
8192
      }
8193
      else {
8194
          for (const key in next) {
8195
              setStyle(style, key, next[key]);
8196
          }
8197
          if (prev && !isString(prev)) {
8198
              for (const key in prev) {
8199
                  if (next[key] == null) {
8200
                      setStyle(style, key, '');
8201
                  }
8202
              }
8203
          }
8204
      }
8205
  }
8206
  const importantRE = /\s*!important$/;
8207
  function setStyle(style, name, val) {
8208
      if (isArray(val)) {
8209
          val.forEach(v => setStyle(style, name, v));
8210
      }
8211
      else {
8212
          if (name.startsWith('--')) {
8213
              // custom property definition
8214
              style.setProperty(name, val);
8215
          }
8216
          else {
8217
              const prefixed = autoPrefix(style, name);
8218
              if (importantRE.test(val)) {
8219
                  // !important
8220
                  style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
8221
              }
8222
              else {
8223
                  style[prefixed] = val;
8224
              }
8225
          }
8226
      }
8227
  }
8228
  const prefixes = ['Webkit', 'Moz', 'ms'];
8229
  const prefixCache = {};
8230
  function autoPrefix(style, rawName) {
8231
      const cached = prefixCache[rawName];
8232
      if (cached) {
8233
          return cached;
8234
      }
8235
      let name = camelize(rawName);
8236
      if (name !== 'filter' && name in style) {
8237
          return (prefixCache[rawName] = name);
8238
      }
8239
      name = capitalize(name);
8240
      for (let i = 0; i < prefixes.length; i++) {
8241
          const prefixed = prefixes[i] + name;
8242
          if (prefixed in style) {
8243
              return (prefixCache[rawName] = prefixed);
8244
          }
8245
      }
8246
      return rawName;
8247
  }
8248
 
8249
  const xlinkNS = 'http://www.w3.org/1999/xlink';
8250
  function patchAttr(el, key, value, isSVG) {
8251
      if (isSVG && key.startsWith('xlink:')) {
8252
          if (value == null) {
8253
              el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
8254
          }
8255
          else {
8256
              el.setAttributeNS(xlinkNS, key, value);
8257
          }
8258
      }
8259
      else {
8260
          // note we are only checking boolean attributes that don't have a
8261
          // corresponding dom prop of the same name here.
8262
          const isBoolean = isSpecialBooleanAttr(key);
8263
          if (value == null || (isBoolean && value === false)) {
8264
              el.removeAttribute(key);
8265
          }
8266
          else {
8267
              el.setAttribute(key, isBoolean ? '' : value);
8268
          }
8269
      }
8270
  }
8271
 
8272
  // __UNSAFE__
8273
  // functions. The user is responsible for using them with only trusted content.
8274
  function patchDOMProp(el, key, value,
8275
  // the following args are passed only due to potential innerHTML/textContent
8276
  // overriding existing VNodes, in which case the old tree must be properly
8277
  // unmounted.
8278
  prevChildren, parentComponent, parentSuspense, unmountChildren) {
8279
      if (key === 'innerHTML' || key === 'textContent') {
8280
          if (prevChildren) {
8281
              unmountChildren(prevChildren, parentComponent, parentSuspense);
8282
          }
8283
          el[key] = value == null ? '' : value;
8284
          return;
8285
      }
8286
      if (key === 'value' && el.tagName !== 'PROGRESS') {
8287
          // store value as _value as well since
8288
          // non-string values will be stringified.
8289
          el._value = value;
8290
          const newValue = value == null ? '' : value;
8291
          if (el.value !== newValue) {
8292
              el.value = newValue;
8293
          }
8294
          return;
8295
      }
8296
      if (value === '' || value == null) {
8297
          const type = typeof el[key];
8298
          if (value === '' && type === 'boolean') {
8299
              // e.g. <select multiple> compiles to { multiple: '' }
8300
              el[key] = true;
8301
              return;
8302
          }
8303
          else if (value == null && type === 'string') {
8304
              // e.g. <div :id="null">
8305
              el[key] = '';
8306
              el.removeAttribute(key);
8307
              return;
8308
          }
8309
          else if (type === 'number') {
8310
              // e.g. <img :width="null">
8311
              el[key] = 0;
8312
              el.removeAttribute(key);
8313
              return;
8314
          }
8315
      }
8316
      // some properties perform value validation and throw
8317
      try {
8318
          el[key] = value;
8319
      }
8320
      catch (e) {
8321
          {
8322
              warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
8323
                  `value ${value} is invalid.`, e);
8324
          }
8325
      }
8326
  }
8327
 
8328
  // Async edge case fix requires storing an event listener's attach timestamp.
8329
  let _getNow = Date.now;
8330
  // Determine what event timestamp the browser is using. Annoyingly, the
8331
  // timestamp can either be hi-res (relative to page load) or low-res
8332
  // (relative to UNIX epoch), so in order to compare time we have to use the
8333
  // same timestamp type when saving the flush timestamp.
8334
  if (typeof document !== 'undefined' &&
8335
      _getNow() > document.createEvent('Event').timeStamp) {
8336
      // if the low-res timestamp which is bigger than the event timestamp
8337
      // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
8338
      // and we need to use the hi-res version for event listeners as well.
8339
      _getNow = () => performance.now();
8340
  }
8341
  // To avoid the overhead of repeatedly calling performance.now(), we cache
8342
  // and use the same timestamp for all event listeners attached in the same tick.
8343
  let cachedNow = 0;
8344
  const p = Promise.resolve();
8345
  const reset = () => {
8346
      cachedNow = 0;
8347
  };
8348
  const getNow = () => cachedNow || (p.then(reset), (cachedNow = _getNow()));
8349
  function addEventListener(el, event, handler, options) {
8350
      el.addEventListener(event, handler, options);
8351
  }
8352
  function removeEventListener(el, event, handler, options) {
8353
      el.removeEventListener(event, handler, options);
8354
  }
8355
  function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8356
      // vei = vue event invokers
8357
      const invokers = el._vei || (el._vei = {});
8358
      const existingInvoker = invokers[rawName];
8359
      if (nextValue && existingInvoker) {
8360
          // patch
8361
          existingInvoker.value = nextValue;
8362
      }
8363
      else {
8364
          const [name, options] = parseName(rawName);
8365
          if (nextValue) {
8366
              // add
8367
              const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
8368
              addEventListener(el, name, invoker, options);
8369
          }
8370
          else if (existingInvoker) {
8371
              // remove
8372
              removeEventListener(el, name, existingInvoker, options);
8373
              invokers[rawName] = undefined;
8374
          }
8375
      }
8376
  }
8377
  const optionsModifierRE = /(?:Once|Passive|Capture)$/;
8378
  function parseName(name) {
8379
      let options;
8380
      if (optionsModifierRE.test(name)) {
8381
          options = {};
8382
          let m;
8383
          while ((m = name.match(optionsModifierRE))) {
8384
              name = name.slice(0, name.length - m[0].length);
8385
              options[m[0].toLowerCase()] = true;
8386
          }
8387
      }
8388
      return [name.slice(2).toLowerCase(), options];
8389
  }
8390
  function createInvoker(initialValue, instance) {
8391
      const invoker = (e) => {
8392
          // async edge case #6566: inner click event triggers patch, event handler
8393
          // attached to outer element during patch, and triggered again. This
8394
          // happens because browsers fire microtask ticks between event propagation.
8395
          // the solution is simple: we save the timestamp when a handler is attached,
8396
          // and the handler would only fire if the event passed to it was fired
8397
          // AFTER it was attached.
8398
          const timeStamp = e.timeStamp || _getNow();
8399
          if (timeStamp >= invoker.attached - 1) {
8400
              callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
8401
          }
8402
      };
8403
      invoker.value = initialValue;
8404
      invoker.attached = getNow();
8405
      return invoker;
8406
  }
8407
  function patchStopImmediatePropagation(e, value) {
8408
      if (isArray(value)) {
8409
          const originalStop = e.stopImmediatePropagation;
8410
          e.stopImmediatePropagation = () => {
8411
              originalStop.call(e);
8412
              e._stopped = true;
8413
          };
8414
          return value.map(fn => (e) => !e._stopped && fn(e));
8415
      }
8416
      else {
8417
          return value;
8418
      }
8419
  }
8420
 
8421
  const nativeOnRE = /^on[a-z]/;
8422
  const forcePatchProp = (_, key) => key === 'value';
8423
  const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
8424
      switch (key) {
8425
          // special
8426
          case 'class':
8427
              patchClass(el, nextValue, isSVG);
8428
              break;
8429
          case 'style':
8430
              patchStyle(el, prevValue, nextValue);
8431
              break;
8432
          default:
8433
              if (isOn(key)) {
8434
                  // ignore v-model listeners
8435
                  if (!isModelListener(key)) {
8436
                      patchEvent(el, key, prevValue, nextValue, parentComponent);
8437
                  }
8438
              }
8439
              else if (shouldSetAsProp(el, key, nextValue, isSVG)) {
8440
                  patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
8441
              }
8442
              else {
8443
                  // special case for <input v-model type="checkbox"> with
8444
                  // :true-value & :false-value
8445
                  // store value as dom properties since non-string values will be
8446
                  // stringified.
8447
                  if (key === 'true-value') {
8448
                      el._trueValue = nextValue;
8449
                  }
8450
                  else if (key === 'false-value') {
8451
                      el._falseValue = nextValue;
8452
                  }
8453
                  patchAttr(el, key, nextValue, isSVG);
8454
              }
8455
              break;
8456
      }
8457
  };
8458
  function shouldSetAsProp(el, key, value, isSVG) {
8459
      if (isSVG) {
8460
          // most keys must be set as attribute on svg elements to work
8461
          // ...except innerHTML
8462
          if (key === 'innerHTML') {
8463
              return true;
8464
          }
8465
          // or native onclick with function values
8466
          if (key in el && nativeOnRE.test(key) && isFunction(value)) {
8467
              return true;
8468
          }
8469
          return false;
8470
      }
8471
      // spellcheck and draggable are numerated attrs, however their
8472
      // corresponding DOM properties are actually booleans - this leads to
8473
      // setting it with a string "false" value leading it to be coerced to
8474
      // `true`, so we need to always treat them as attributes.
8475
      // Note that `contentEditable` doesn't have this problem: its DOM
8476
      // property is also enumerated string values.
8477
      if (key === 'spellcheck' || key === 'draggable') {
8478
          return false;
8479
      }
8480
      // #1787 form as an attribute must be a string, while it accepts an Element as
8481
      // a prop
8482
      if (key === 'form' && typeof value === 'string') {
8483
          return false;
8484
      }
8485
      // #1526 <input list> must be set as attribute
8486
      if (key === 'list' && el.tagName === 'INPUT') {
8487
          return false;
8488
      }
8489
      // native onclick with string value, must be set as attribute
8490
      if (nativeOnRE.test(key) && isString(value)) {
8491
          return false;
8492
      }
8493
      return key in el;
8494
  }
8495
 
8496
  function useCssModule(name = '$style') {
8497
      /* istanbul ignore else */
8498
      {
8499
          {
8500
              warn(`useCssModule() is not supported in the global build.`);
8501
          }
8502
          return EMPTY_OBJ;
8503
      }
8504
  }
8505
 
8506
  /**
8507
   * Runtime helper for SFC's CSS variable injection feature.
8508
   * @private
8509
   */
8510
  function useCssVars(getter) {
8511
      const instance = getCurrentInstance();
8512
      /* istanbul ignore next */
8513
      if (!instance) {
8514
 
8515
              warn(`useCssVars is called without current active component instance.`);
8516
          return;
8517
      }
8518
      const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
8519
      onMounted(() => watchEffect(setVars, { flush: 'post' }));
8520
      onUpdated(setVars);
8521
  }
8522
  function setVarsOnVNode(vnode, vars) {
8523
      if ( vnode.shapeFlag & 128 /* SUSPENSE */) {
8524
          const suspense = vnode.suspense;
8525
          vnode = suspense.activeBranch;
8526
          if (suspense.pendingBranch && !suspense.isHydrating) {
8527
              suspense.effects.push(() => {
8528
                  setVarsOnVNode(suspense.activeBranch, vars);
8529
              });
8530
          }
8531
      }
8532
      // drill down HOCs until it's a non-component vnode
8533
      while (vnode.component) {
8534
          vnode = vnode.component.subTree;
8535
      }
8536
      if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
8537
          const style = vnode.el.style;
8538
          for (const key in vars) {
8539
              style.setProperty(`--${key}`, vars[key]);
8540
          }
8541
      }
8542
      else if (vnode.type === Fragment) {
8543
          vnode.children.forEach(c => setVarsOnVNode(c, vars));
8544
      }
8545
  }
8546
 
8547
  const TRANSITION = 'transition';
8548
  const ANIMATION = 'animation';
8549
  // DOM Transition is a higher-order-component based on the platform-agnostic
8550
  // base Transition component, with DOM-specific logic.
8551
  const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
8552
  Transition.displayName = 'Transition';
8553
  const DOMTransitionPropsValidators = {
8554
      name: String,
8555
      type: String,
8556
      css: {
8557
          type: Boolean,
8558
          default: true
8559
      },
8560
      duration: [String, Number, Object],
8561
      enterFromClass: String,
8562
      enterActiveClass: String,
8563
      enterToClass: String,
8564
      appearFromClass: String,
8565
      appearActiveClass: String,
8566
      appearToClass: String,
8567
      leaveFromClass: String,
8568
      leaveActiveClass: String,
8569
      leaveToClass: String
8570
  };
8571
  const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend({}, BaseTransition.props, DOMTransitionPropsValidators));
8572
  function resolveTransitionProps(rawProps) {
8573
      let { name = 'v', type, css = true, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
8574
      const baseProps = {};
8575
      for (const key in rawProps) {
8576
          if (!(key in DOMTransitionPropsValidators)) {
8577
              baseProps[key] = rawProps[key];
8578
          }
8579
      }
8580
      if (!css) {
8581
          return baseProps;
8582
      }
8583
      const durations = normalizeDuration(duration);
8584
      const enterDuration = durations && durations[0];
8585
      const leaveDuration = durations && durations[1];
8586
      const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
8587
      const finishEnter = (el, isAppear, done) => {
8588
          removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
8589
          removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
8590
          done && done();
8591
      };
8592
      const finishLeave = (el, done) => {
8593
          removeTransitionClass(el, leaveToClass);
8594
          removeTransitionClass(el, leaveActiveClass);
8595
          done && done();
8596
      };
8597
      const makeEnterHook = (isAppear) => {
8598
          return (el, done) => {
8599
              const hook = isAppear ? onAppear : onEnter;
8600
              const resolve = () => finishEnter(el, isAppear, done);
8601
              hook && hook(el, resolve);
8602
              nextFrame(() => {
8603
                  removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
8604
                  addTransitionClass(el, isAppear ? appearToClass : enterToClass);
8605
                  if (!(hook && hook.length > 1)) {
8606
                      whenTransitionEnds(el, type, enterDuration, resolve);
8607
                  }
8608
              });
8609
          };
8610
      };
8611
      return extend(baseProps, {
8612
          onBeforeEnter(el) {
8613
              onBeforeEnter && onBeforeEnter(el);
8614
              addTransitionClass(el, enterFromClass);
8615
              addTransitionClass(el, enterActiveClass);
8616
          },
8617
          onBeforeAppear(el) {
8618
              onBeforeAppear && onBeforeAppear(el);
8619
              addTransitionClass(el, appearFromClass);
8620
              addTransitionClass(el, appearActiveClass);
8621
          },
8622
          onEnter: makeEnterHook(false),
8623
          onAppear: makeEnterHook(true),
8624
          onLeave(el, done) {
8625
              const resolve = () => finishLeave(el, done);
8626
              addTransitionClass(el, leaveFromClass);
8627
              // force reflow so *-leave-from classes immediately take effect (#2593)
8628
              forceReflow();
8629
              addTransitionClass(el, leaveActiveClass);
8630
              nextFrame(() => {
8631
                  removeTransitionClass(el, leaveFromClass);
8632
                  addTransitionClass(el, leaveToClass);
8633
                  if (!(onLeave && onLeave.length > 1)) {
8634
                      whenTransitionEnds(el, type, leaveDuration, resolve);
8635
                  }
8636
              });
8637
              onLeave && onLeave(el, resolve);
8638
          },
8639
          onEnterCancelled(el) {
8640
              finishEnter(el, false);
8641
              onEnterCancelled && onEnterCancelled(el);
8642
          },
8643
          onAppearCancelled(el) {
8644
              finishEnter(el, true);
8645
              onAppearCancelled && onAppearCancelled(el);
8646
          },
8647
          onLeaveCancelled(el) {
8648
              finishLeave(el);
8649
              onLeaveCancelled && onLeaveCancelled(el);
8650
          }
8651
      });
8652
  }
8653
  function normalizeDuration(duration) {
8654
      if (duration == null) {
8655
          return null;
8656
      }
8657
      else if (isObject(duration)) {
8658
          return [NumberOf(duration.enter), NumberOf(duration.leave)];
8659
      }
8660
      else {
8661
          const n = NumberOf(duration);
8662
          return [n, n];
8663
      }
8664
  }
8665
  function NumberOf(val) {
8666
      const res = toNumber(val);
8667
      validateDuration(res);
8668
      return res;
8669
  }
8670
  function validateDuration(val) {
8671
      if (typeof val !== 'number') {
8672
          warn(`<transition> explicit duration is not a valid number - ` +
8673
              `got ${JSON.stringify(val)}.`);
8674
      }
8675
      else if (isNaN(val)) {
8676
          warn(`<transition> explicit duration is NaN - ` +
8677
              'the duration expression might be incorrect.');
8678
      }
8679
  }
8680
  function addTransitionClass(el, cls) {
8681
      cls.split(/\s+/).forEach(c => c && el.classList.add(c));
8682
      (el._vtc ||
8683
          (el._vtc = new Set())).add(cls);
8684
  }
8685
  function removeTransitionClass(el, cls) {
8686
      cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
8687
      const { _vtc } = el;
8688
      if (_vtc) {
8689
          _vtc.delete(cls);
8690
          if (!_vtc.size) {
8691
              el._vtc = undefined;
8692
          }
8693
      }
8694
  }
8695
  function nextFrame(cb) {
8696
      requestAnimationFrame(() => {
8697
          requestAnimationFrame(cb);
8698
      });
8699
  }
8700
  let endId = 0;
8701
  function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
8702
      const id = (el._endId = ++endId);
8703
      const resolveIfNotStale = () => {
8704
          if (id === el._endId) {
8705
              resolve();
8706
          }
8707
      };
8708
      if (explicitTimeout) {
8709
          return setTimeout(resolveIfNotStale, explicitTimeout);
8710
      }
8711
      const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
8712
      if (!type) {
8713
          return resolve();
8714
      }
8715
      const endEvent = type + 'end';
8716
      let ended = 0;
8717
      const end = () => {
8718
          el.removeEventListener(endEvent, onEnd);
8719
          resolveIfNotStale();
8720
      };
8721
      const onEnd = (e) => {
8722
          if (e.target === el && ++ended >= propCount) {
8723
              end();
8724
          }
8725
      };
8726
      setTimeout(() => {
8727
          if (ended < propCount) {
8728
              end();
8729
          }
8730
      }, timeout + 1);
8731
      el.addEventListener(endEvent, onEnd);
8732
  }
8733
  function getTransitionInfo(el, expectedType) {
8734
      const styles = window.getComputedStyle(el);
8735
      // JSDOM may return undefined for transition properties
8736
      const getStyleProperties = (key) => (styles[key] || '').split(', ');
8737
      const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
8738
      const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
8739
      const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
8740
      const animationDelays = getStyleProperties(ANIMATION + 'Delay');
8741
      const animationDurations = getStyleProperties(ANIMATION + 'Duration');
8742
      const animationTimeout = getTimeout(animationDelays, animationDurations);
8743
      let type = null;
8744
      let timeout = 0;
8745
      let propCount = 0;
8746
      /* istanbul ignore if */
8747
      if (expectedType === TRANSITION) {
8748
          if (transitionTimeout > 0) {
8749
              type = TRANSITION;
8750
              timeout = transitionTimeout;
8751
              propCount = transitionDurations.length;
8752
          }
8753
      }
8754
      else if (expectedType === ANIMATION) {
8755
          if (animationTimeout > 0) {
8756
              type = ANIMATION;
8757
              timeout = animationTimeout;
8758
              propCount = animationDurations.length;
8759
          }
8760
      }
8761
      else {
8762
          timeout = Math.max(transitionTimeout, animationTimeout);
8763
          type =
8764
              timeout > 0
8765
                  ? transitionTimeout > animationTimeout
8766
                      ? TRANSITION
8767
                      : ANIMATION
8768
                  : null;
8769
          propCount = type
8770
              ? type === TRANSITION
8771
                  ? transitionDurations.length
8772
                  : animationDurations.length
8773
              : 0;
8774
      }
8775
      const hasTransform = type === TRANSITION &&
8776
          /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
8777
      return {
8778
          type,
8779
          timeout,
8780
          propCount,
8781
          hasTransform
8782
      };
8783
  }
8784
  function getTimeout(delays, durations) {
8785
      while (delays.length < durations.length) {
8786
          delays = delays.concat(delays);
8787
      }
8788
      return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
8789
  }
8790
  // Old versions of Chromium (below 61.0.3163.100) formats floating pointer
8791
  // numbers in a locale-dependent way, using a comma instead of a dot.
8792
  // If comma is not replaced with a dot, the input will be rounded down
8793
  // (i.e. acting as a floor function) causing unexpected behaviors
8794
  function toMs(s) {
8795
      return Number(s.slice(0, -1).replace(',', '.')) * 1000;
8796
  }
8797
  // synchronously force layout to put elements into a certain state
8798
  function forceReflow() {
8799
      return document.body.offsetHeight;
8800
  }
8801
 
8802
  const positionMap = new WeakMap();
8803
  const newPositionMap = new WeakMap();
8804
  const TransitionGroupImpl = {
8805
      name: 'TransitionGroup',
8806
      props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
8807
          tag: String,
8808
          moveClass: String
8809
      }),
8810
      setup(props, { slots }) {
8811
          const instance = getCurrentInstance();
8812
          const state = useTransitionState();
8813
          let prevChildren;
8814
          let children;
8815
          onUpdated(() => {
8816
              // children is guaranteed to exist after initial render
8817
              if (!prevChildren.length) {
8818
                  return;
8819
              }
8820
              const moveClass = props.moveClass || `${props.name || 'v'}-move`;
8821
              if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
8822
                  return;
8823
              }
8824
              // we divide the work into three loops to avoid mixing DOM reads and writes
8825
              // in each iteration - which helps prevent layout thrashing.
8826
              prevChildren.forEach(callPendingCbs);
8827
              prevChildren.forEach(recordPosition);
8828
              const movedChildren = prevChildren.filter(applyTranslation);
8829
              // force reflow to put everything in position
8830
              forceReflow();
8831
              movedChildren.forEach(c => {
8832
                  const el = c.el;
8833
                  const style = el.style;
8834
                  addTransitionClass(el, moveClass);
8835
                  style.transform = style.webkitTransform = style.transitionDuration = '';
8836
                  const cb = (el._moveCb = (e) => {
8837
                      if (e && e.target !== el) {
8838
                          return;
8839
                      }
8840
                      if (!e || /transform$/.test(e.propertyName)) {
8841
                          el.removeEventListener('transitionend', cb);
8842
                          el._moveCb = null;
8843
                          removeTransitionClass(el, moveClass);
8844
                      }
8845
                  });
8846
                  el.addEventListener('transitionend', cb);
8847
              });
8848
          });
8849
          return () => {
8850
              const rawProps = toRaw(props);
8851
              const cssTransitionProps = resolveTransitionProps(rawProps);
8852
              const tag = rawProps.tag || Fragment;
8853
              prevChildren = children;
8854
              children = slots.default ? getTransitionRawChildren(slots.default()) : [];
8855
              for (let i = 0; i < children.length; i++) {
8856
                  const child = children[i];
8857
                  if (child.key != null) {
8858
                      setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
8859
                  }
8860
                  else {
8861
                      warn(`<TransitionGroup> children must be keyed.`);
8862
                  }
8863
              }
8864
              if (prevChildren) {
8865
                  for (let i = 0; i < prevChildren.length; i++) {
8866
                      const child = prevChildren[i];
8867
                      setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
8868
                      positionMap.set(child, child.el.getBoundingClientRect());
8869
                  }
8870
              }
8871
              return createVNode(tag, null, children);
8872
          };
8873
      }
8874
  };
8875
  const TransitionGroup = TransitionGroupImpl;
8876
  function callPendingCbs(c) {
8877
      const el = c.el;
8878
      if (el._moveCb) {
8879
          el._moveCb();
8880
      }
8881
      if (el._enterCb) {
8882
          el._enterCb();
8883
      }
8884
  }
8885
  function recordPosition(c) {
8886
      newPositionMap.set(c, c.el.getBoundingClientRect());
8887
  }
8888
  function applyTranslation(c) {
8889
      const oldPos = positionMap.get(c);
8890
      const newPos = newPositionMap.get(c);
8891
      const dx = oldPos.left - newPos.left;
8892
      const dy = oldPos.top - newPos.top;
8893
      if (dx || dy) {
8894
          const s = c.el.style;
8895
          s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
8896
          s.transitionDuration = '0s';
8897
          return c;
8898
      }
8899
  }
8900
  function hasCSSTransform(el, root, moveClass) {
8901
      // Detect whether an element with the move class applied has
8902
      // CSS transitions. Since the element may be inside an entering
8903
      // transition at this very moment, we make a clone of it and remove
8904
      // all other transition classes applied to ensure only the move class
8905
      // is applied.
8906
      const clone = el.cloneNode();
8907
      if (el._vtc) {
8908
          el._vtc.forEach(cls => {
8909
              cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
8910
          });
8911
      }
8912
      moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
8913
      clone.style.display = 'none';
8914
      const container = (root.nodeType === 1
8915
          ? root
8916
          : root.parentNode);
8917
      container.appendChild(clone);
8918
      const { hasTransform } = getTransitionInfo(clone);
8919
      container.removeChild(clone);
8920
      return hasTransform;
8921
  }
8922
 
8923
  const getModelAssigner = (vnode) => {
8924
      const fn = vnode.props['onUpdate:modelValue'];
8925
      return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
8926
  };
8927
  function onCompositionStart(e) {
8928
      e.target.composing = true;
8929
  }
8930
  function onCompositionEnd(e) {
8931
      const target = e.target;
8932
      if (target.composing) {
8933
          target.composing = false;
8934
          trigger$1(target, 'input');
8935
      }
8936
  }
8937
  function trigger$1(el, type) {
8938
      const e = document.createEvent('HTMLEvents');
8939
      e.initEvent(type, true, true);
8940
      el.dispatchEvent(e);
8941
  }
8942
  // We are exporting the v-model runtime directly as vnode hooks so that it can
8943
  // be tree-shaken in case v-model is never used.
8944
  const vModelText = {
8945
      created(el, { modifiers: { lazy, trim, number } }, vnode) {
8946
          el._assign = getModelAssigner(vnode);
8947
          const castToNumber = number || el.type === 'number';
8948
          addEventListener(el, lazy ? 'change' : 'input', e => {
8949
              if (e.target.composing)
8950
                  return;
8951
              let domValue = el.value;
8952
              if (trim) {
8953
                  domValue = domValue.trim();
8954
              }
8955
              else if (castToNumber) {
8956
                  domValue = toNumber(domValue);
8957
              }
8958
              el._assign(domValue);
8959
          });
8960
          if (trim) {
8961
              addEventListener(el, 'change', () => {
8962
                  el.value = el.value.trim();
8963
              });
8964
          }
8965
          if (!lazy) {
8966
              addEventListener(el, 'compositionstart', onCompositionStart);
8967
              addEventListener(el, 'compositionend', onCompositionEnd);
8968
              // Safari < 10.2 & UIWebView doesn't fire compositionend when
8969
              // switching focus before confirming composition choice
8970
              // this also fixes the issue where some browsers e.g. iOS Chrome
8971
              // fires "change" instead of "input" on autocomplete.
8972
              addEventListener(el, 'change', onCompositionEnd);
8973
          }
8974
      },
8975
      // set value on mounted so it's after min/max for type="range"
8976
      mounted(el, { value }) {
8977
          el.value = value == null ? '' : value;
8978
      },
8979
      beforeUpdate(el, { value, modifiers: { trim, number } }, vnode) {
8980
          el._assign = getModelAssigner(vnode);
8981
          // avoid clearing unresolved text. #2302
8982
          if (el.composing)
8983
              return;
8984
          if (document.activeElement === el) {
8985
              if (trim && el.value.trim() === value) {
8986
                  return;
8987
              }
8988
              if ((number || el.type === 'number') && toNumber(el.value) === value) {
8989
                  return;
8990
              }
8991
          }
8992
          const newValue = value == null ? '' : value;
8993
          if (el.value !== newValue) {
8994
              el.value = newValue;
8995
          }
8996
      }
8997
  };
8998
  const vModelCheckbox = {
8999
      created(el, _, vnode) {
9000
          el._assign = getModelAssigner(vnode);
9001
          addEventListener(el, 'change', () => {
9002
              const modelValue = el._modelValue;
9003
              const elementValue = getValue(el);
9004
              const checked = el.checked;
9005
              const assign = el._assign;
9006
              if (isArray(modelValue)) {
9007
                  const index = looseIndexOf(modelValue, elementValue);
9008
                  const found = index !== -1;
9009
                  if (checked && !found) {
9010
                      assign(modelValue.concat(elementValue));
9011
                  }
9012
                  else if (!checked && found) {
9013
                      const filtered = [...modelValue];
9014
                      filtered.splice(index, 1);
9015
                      assign(filtered);
9016
                  }
9017
              }
9018
              else if (isSet(modelValue)) {
9019
                  const cloned = new Set(modelValue);
9020
                  if (checked) {
9021
                      cloned.add(elementValue);
9022
                  }
9023
                  else {
9024
                      cloned.delete(elementValue);
9025
                  }
9026
                  assign(cloned);
9027
              }
9028
              else {
9029
                  assign(getCheckboxValue(el, checked));
9030
              }
9031
          });
9032
      },
9033
      // set initial checked on mount to wait for true-value/false-value
9034
      mounted: setChecked,
9035
      beforeUpdate(el, binding, vnode) {
9036
          el._assign = getModelAssigner(vnode);
9037
          setChecked(el, binding, vnode);
9038
      }
9039
  };
9040
  function setChecked(el, { value, oldValue }, vnode) {
9041
      el._modelValue = value;
9042
      if (isArray(value)) {
9043
          el.checked = looseIndexOf(value, vnode.props.value) > -1;
9044
      }
9045
      else if (isSet(value)) {
9046
          el.checked = value.has(vnode.props.value);
9047
      }
9048
      else if (value !== oldValue) {
9049
          el.checked = looseEqual(value, getCheckboxValue(el, true));
9050
      }
9051
  }
9052
  const vModelRadio = {
9053
      created(el, { value }, vnode) {
9054
          el.checked = looseEqual(value, vnode.props.value);
9055
          el._assign = getModelAssigner(vnode);
9056
          addEventListener(el, 'change', () => {
9057
              el._assign(getValue(el));
9058
          });
9059
      },
9060
      beforeUpdate(el, { value, oldValue }, vnode) {
9061
          el._assign = getModelAssigner(vnode);
9062
          if (value !== oldValue) {
9063
              el.checked = looseEqual(value, vnode.props.value);
9064
          }
9065
      }
9066
  };
9067
  const vModelSelect = {
9068
      created(el, { value, modifiers: { number } }, vnode) {
9069
          const isSetModel = isSet(value);
9070
          addEventListener(el, 'change', () => {
9071
              const selectedVal = Array.prototype.filter
9072
                  .call(el.options, (o) => o.selected)
9073
                  .map((o) => number ? toNumber(getValue(o)) : getValue(o));
9074
              el._assign(el.multiple
9075
                  ? isSetModel
9076
                      ? new Set(selectedVal)
9077
                      : selectedVal
9078
                  : selectedVal[0]);
9079
          });
9080
          el._assign = getModelAssigner(vnode);
9081
      },
9082
      // set value in mounted & updated because <select> relies on its children
9083
      // <option>s.
9084
      mounted(el, { value }) {
9085
          setSelected(el, value);
9086
      },
9087
      beforeUpdate(el, _binding, vnode) {
9088
          el._assign = getModelAssigner(vnode);
9089
      },
9090
      updated(el, { value }) {
9091
          setSelected(el, value);
9092
      }
9093
  };
9094
  function setSelected(el, value) {
9095
      const isMultiple = el.multiple;
9096
      if (isMultiple && !isArray(value) && !isSet(value)) {
9097
 
9098
              warn(`<select multiple v-model> expects an Array or Set value for its binding, ` +
9099
                  `but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
9100
          return;
9101
      }
9102
      for (let i = 0, l = el.options.length; i < l; i++) {
9103
          const option = el.options[i];
9104
          const optionValue = getValue(option);
9105
          if (isMultiple) {
9106
              if (isArray(value)) {
9107
                  option.selected = looseIndexOf(value, optionValue) > -1;
9108
              }
9109
              else {
9110
                  option.selected = value.has(optionValue);
9111
              }
9112
          }
9113
          else {
9114
              if (looseEqual(getValue(option), value)) {
9115
                  el.selectedIndex = i;
9116
                  return;
9117
              }
9118
          }
9119
      }
9120
      if (!isMultiple) {
9121
          el.selectedIndex = -1;
9122
      }
9123
  }
9124
  // retrieve raw value set via :value bindings
9125
  function getValue(el) {
9126
      return '_value' in el ? el._value : el.value;
9127
  }
9128
  // retrieve raw value for true-value and false-value set via :true-value or :false-value bindings
9129
  function getCheckboxValue(el, checked) {
9130
      const key = checked ? '_trueValue' : '_falseValue';
9131
      return key in el ? el[key] : checked;
9132
  }
9133
  const vModelDynamic = {
9134
      created(el, binding, vnode) {
9135
          callModelHook(el, binding, vnode, null, 'created');
9136
      },
9137
      mounted(el, binding, vnode) {
9138
          callModelHook(el, binding, vnode, null, 'mounted');
9139
      },
9140
      beforeUpdate(el, binding, vnode, prevVNode) {
9141
          callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate');
9142
      },
9143
      updated(el, binding, vnode, prevVNode) {
9144
          callModelHook(el, binding, vnode, prevVNode, 'updated');
9145
      }
9146
  };
9147
  function callModelHook(el, binding, vnode, prevVNode, hook) {
9148
      let modelToUse;
9149
      switch (el.tagName) {
9150
          case 'SELECT':
9151
              modelToUse = vModelSelect;
9152
              break;
9153
          case 'TEXTAREA':
9154
              modelToUse = vModelText;
9155
              break;
9156
          default:
9157
              switch (vnode.props && vnode.props.type) {
9158
                  case 'checkbox':
9159
                      modelToUse = vModelCheckbox;
9160
                      break;
9161
                  case 'radio':
9162
                      modelToUse = vModelRadio;
9163
                      break;
9164
                  default:
9165
                      modelToUse = vModelText;
9166
              }
9167
      }
9168
      const fn = modelToUse[hook];
9169
      fn && fn(el, binding, vnode, prevVNode);
9170
  }
9171
 
9172
  const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
9173
  const modifierGuards = {
9174
      stop: e => e.stopPropagation(),
9175
      prevent: e => e.preventDefault(),
9176
      self: e => e.target !== e.currentTarget,
9177
      ctrl: e => !e.ctrlKey,
9178
      shift: e => !e.shiftKey,
9179
      alt: e => !e.altKey,
9180
      meta: e => !e.metaKey,
9181
      left: e => 'button' in e && e.button !== 0,
9182
      middle: e => 'button' in e && e.button !== 1,
9183
      right: e => 'button' in e && e.button !== 2,
9184
      exact: (e, modifiers) => systemModifiers.some(m => e[`${m}Key`] && !modifiers.includes(m))
9185
  };
9186
  /**
9187
   * @private
9188
   */
9189
  const withModifiers = (fn, modifiers) => {
9190
      return (event, ...args) => {
9191
          for (let i = 0; i < modifiers.length; i++) {
9192
              const guard = modifierGuards[modifiers[i]];
9193
              if (guard && guard(event, modifiers))
9194
                  return;
9195
          }
9196
          return fn(event, ...args);
9197
      };
9198
  };
9199
  // Kept for 2.x compat.
9200
  // Note: IE11 compat for `spacebar` and `del` is removed for now.
9201
  const keyNames = {
9202
      esc: 'escape',
9203
      space: ' ',
9204
      up: 'arrow-up',
9205
      left: 'arrow-left',
9206
      right: 'arrow-right',
9207
      down: 'arrow-down',
9208
      delete: 'backspace'
9209
  };
9210
  /**
9211
   * @private
9212
   */
9213
  const withKeys = (fn, modifiers) => {
9214
      return (event) => {
9215
          if (!('key' in event))
9216
              return;
9217
          const eventKey = hyphenate(event.key);
9218
          if (
9219
          // None of the provided key modifiers match the current event key
9220
          !modifiers.some(k => k === eventKey || keyNames[k] === eventKey)) {
9221
              return;
9222
          }
9223
          return fn(event);
9224
      };
9225
  };
9226
 
9227
  const vShow = {
9228
      beforeMount(el, { value }, { transition }) {
9229
          el._vod = el.style.display === 'none' ? '' : el.style.display;
9230
          if (transition && value) {
9231
              transition.beforeEnter(el);
9232
          }
9233
          else {
9234
              setDisplay(el, value);
9235
          }
9236
      },
9237
      mounted(el, { value }, { transition }) {
9238
          if (transition && value) {
9239
              transition.enter(el);
9240
          }
9241
      },
9242
      updated(el, { value, oldValue }, { transition }) {
9243
          if (transition && value !== oldValue) {
9244
              if (value) {
9245
                  transition.beforeEnter(el);
9246
                  setDisplay(el, true);
9247
                  transition.enter(el);
9248
              }
9249
              else {
9250
                  transition.leave(el, () => {
9251
                      setDisplay(el, false);
9252
                  });
9253
              }
9254
          }
9255
          else {
9256
              setDisplay(el, value);
9257
          }
9258
      },
9259
      beforeUnmount(el, { value }) {
9260
          setDisplay(el, value);
9261
      }
9262
  };
9263
  function setDisplay(el, value) {
9264
      el.style.display = value ? el._vod : 'none';
9265
  }
9266
 
9267
  const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
9268
  // lazy create the renderer - this makes core renderer logic tree-shakable
9269
  // in case the user only imports reactivity utilities from Vue.
9270
  let renderer;
9271
  let enabledHydration = false;
9272
  function ensureRenderer() {
9273
      return renderer || (renderer = createRenderer(rendererOptions));
9274
  }
9275
  function ensureHydrationRenderer() {
9276
      renderer = enabledHydration
9277
          ? renderer
9278
          : createHydrationRenderer(rendererOptions);
9279
      enabledHydration = true;
9280
      return renderer;
9281
  }
9282
  // use explicit type casts here to avoid import() calls in rolled-up d.ts
9283
  const render = ((...args) => {
9284
      ensureRenderer().render(...args);
9285
  });
9286
  const hydrate = ((...args) => {
9287
      ensureHydrationRenderer().hydrate(...args);
9288
  });
9289
  const createApp = ((...args) => {
9290
      const app = ensureRenderer().createApp(...args);
9291
      {
9292
          injectNativeTagCheck(app);
9293
      }
9294
      const { mount } = app;
9295
      app.mount = (containerOrSelector) => {
9296
          const container = normalizeContainer(containerOrSelector);
9297
          if (!container)
9298
              return;
9299
          const component = app._component;
9300
          if (!isFunction(component) && !component.render && !component.template) {
9301
              component.template = container.innerHTML;
9302
          }
9303
          // clear content before mounting
9304
          container.innerHTML = '';
9305
          const proxy = mount(container);
9306
          if (container instanceof Element) {
9307
              container.removeAttribute('v-cloak');
9308
              container.setAttribute('data-v-app', '');
9309
          }
9310
          return proxy;
9311
      };
9312
      return app;
9313
  });
9314
  const createSSRApp = ((...args) => {
9315
      const app = ensureHydrationRenderer().createApp(...args);
9316
      {
9317
          injectNativeTagCheck(app);
9318
      }
9319
      const { mount } = app;
9320
      app.mount = (containerOrSelector) => {
9321
          const container = normalizeContainer(containerOrSelector);
9322
          if (container) {
9323
              return mount(container, true);
9324
          }
9325
      };
9326
      return app;
9327
  });
9328
  function injectNativeTagCheck(app) {
9329
      // Inject `isNativeTag`
9330
      // this is used for component name validation (dev only)
9331
      Object.defineProperty(app.config, 'isNativeTag', {
9332
          value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
9333
          writable: false
9334
      });
9335
  }
9336
  function normalizeContainer(container) {
9337
      if (isString(container)) {
9338
          const res = document.querySelector(container);
9339
          if ( !res) {
9340
              warn(`Failed to mount app: mount target selector "${container}" returned null.`);
9341
          }
9342
          return res;
9343
      }
9344
      if (
9345
          container instanceof ShadowRoot &&
9346
          container.mode === 'closed') {
9347
          warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
9348
      }
9349
      return container;
9350
  }
9351
 
9352
  function initDev() {
9353
      const target = getGlobalThis();
9354
      target.__VUE__ = true;
9355
      setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
9356
      {
9357
          {
9358
              console.info(`You are running a development build of Vue.\n` +
9359
                  `Make sure to use the production build (*.prod.js) when deploying for production.`);
9360
          }
9361
          initCustomFormatter();
9362
      }
9363
  }
9364
 
9365
  function defaultOnError(error) {
9366
      throw error;
9367
  }
9368
  function createCompilerError(code, loc, messages, additionalMessage) {
9369
      const msg =  (messages || errorMessages)[code] + (additionalMessage || ``)
9370
          ;
9371
      const error = new SyntaxError(String(msg));
9372
      error.code = code;
9373
      error.loc = loc;
9374
      return error;
9375
  }
9376
  const errorMessages = {
9377
      // parse errors
9378
      [0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
9379
      [1 /* CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
9380
      [2 /* DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
9381
      [3 /* END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
9382
      [4 /* END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
9383
      [5 /* EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
9384
      [6 /* EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
9385
      [7 /* EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
9386
      [8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
9387
      [9 /* EOF_IN_TAG */]: 'Unexpected EOF in tag.',
9388
      [10 /* INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
9389
      [11 /* INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
9390
      [12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
9391
      [13 /* MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
9392
      [14 /* MISSING_END_TAG_NAME */]: 'End tag name was expected.',
9393
      [15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
9394
      [16 /* NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
9395
      [17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
9396
      [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
9397
      [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
9398
      [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
9399
      [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
9400
      // Vue-specific parse errors
9401
      [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
9402
      [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
9403
      [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
9404
      [26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
9405
          'Note that dynamic directive argument cannot contain spaces.',
9406
      // transform errors
9407
      [27 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
9408
      [28 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
9409
      [29 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
9410
      [30 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
9411
      [31 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
9412
      [32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
9413
      [33 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
9414
      [34 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
9415
      [35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
9416
      [36 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
9417
          `When there are multiple named slots, all slots should use <template> ` +
9418
          `syntax to avoid scope ambiguity.`,
9419
      [37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
9420
      [38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
9421
          `default slot. These children will be ignored.`,
9422
      [39 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
9423
      [40 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
9424
      [41 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
9425
      [42 /* X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
9426
      [43 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
9427
      [44 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
9428
      // generic errors
9429
      [45 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
9430
      [46 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
9431
      [47 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
9432
      [48 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`
9433
  };
9434
 
9435
  const FRAGMENT = Symbol( `Fragment` );
9436
  const TELEPORT = Symbol( `Teleport` );
9437
  const SUSPENSE = Symbol( `Suspense` );
9438
  const KEEP_ALIVE = Symbol( `KeepAlive` );
9439
  const BASE_TRANSITION = Symbol( `BaseTransition` );
9440
  const OPEN_BLOCK = Symbol( `openBlock` );
9441
  const CREATE_BLOCK = Symbol( `createBlock` );
9442
  const CREATE_VNODE = Symbol( `createVNode` );
9443
  const CREATE_COMMENT = Symbol( `createCommentVNode` );
9444
  const CREATE_TEXT = Symbol( `createTextVNode` );
9445
  const CREATE_STATIC = Symbol( `createStaticVNode` );
9446
  const RESOLVE_COMPONENT = Symbol( `resolveComponent` );
9447
  const RESOLVE_DYNAMIC_COMPONENT = Symbol( `resolveDynamicComponent` );
9448
  const RESOLVE_DIRECTIVE = Symbol( `resolveDirective` );
9449
  const WITH_DIRECTIVES = Symbol( `withDirectives` );
9450
  const RENDER_LIST = Symbol( `renderList` );
9451
  const RENDER_SLOT = Symbol( `renderSlot` );
9452
  const CREATE_SLOTS = Symbol( `createSlots` );
9453
  const TO_DISPLAY_STRING = Symbol( `toDisplayString` );
9454
  const MERGE_PROPS = Symbol( `mergeProps` );
9455
  const TO_HANDLERS = Symbol( `toHandlers` );
9456
  const CAMELIZE = Symbol( `camelize` );
9457
  const CAPITALIZE = Symbol( `capitalize` );
9458
  const TO_HANDLER_KEY = Symbol( `toHandlerKey` );
9459
  const SET_BLOCK_TRACKING = Symbol( `setBlockTracking` );
9460
  const PUSH_SCOPE_ID = Symbol( `pushScopeId` );
9461
  const POP_SCOPE_ID = Symbol( `popScopeId` );
9462
  const WITH_SCOPE_ID = Symbol( `withScopeId` );
9463
  const WITH_CTX = Symbol( `withCtx` );
9464
  const UNREF = Symbol( `unref` );
9465
  const IS_REF = Symbol( `isRef` );
9466
  // Name mapping for runtime helpers that need to be imported from 'vue' in
9467
  // generated code. Make sure these are correctly exported in the runtime!
9468
  // Using `any` here because TS doesn't allow symbols as index type.
9469
  const helperNameMap = {
9470
      [FRAGMENT]: `Fragment`,
9471
      [TELEPORT]: `Teleport`,
9472
      [SUSPENSE]: `Suspense`,
9473
      [KEEP_ALIVE]: `KeepAlive`,
9474
      [BASE_TRANSITION]: `BaseTransition`,
9475
      [OPEN_BLOCK]: `openBlock`,
9476
      [CREATE_BLOCK]: `createBlock`,
9477
      [CREATE_VNODE]: `createVNode`,
9478
      [CREATE_COMMENT]: `createCommentVNode`,
9479
      [CREATE_TEXT]: `createTextVNode`,
9480
      [CREATE_STATIC]: `createStaticVNode`,
9481
      [RESOLVE_COMPONENT]: `resolveComponent`,
9482
      [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
9483
      [RESOLVE_DIRECTIVE]: `resolveDirective`,
9484
      [WITH_DIRECTIVES]: `withDirectives`,
9485
      [RENDER_LIST]: `renderList`,
9486
      [RENDER_SLOT]: `renderSlot`,
9487
      [CREATE_SLOTS]: `createSlots`,
9488
      [TO_DISPLAY_STRING]: `toDisplayString`,
9489
      [MERGE_PROPS]: `mergeProps`,
9490
      [TO_HANDLERS]: `toHandlers`,
9491
      [CAMELIZE]: `camelize`,
9492
      [CAPITALIZE]: `capitalize`,
9493
      [TO_HANDLER_KEY]: `toHandlerKey`,
9494
      [SET_BLOCK_TRACKING]: `setBlockTracking`,
9495
      [PUSH_SCOPE_ID]: `pushScopeId`,
9496
      [POP_SCOPE_ID]: `popScopeId`,
9497
      [WITH_SCOPE_ID]: `withScopeId`,
9498
      [WITH_CTX]: `withCtx`,
9499
      [UNREF]: `unref`,
9500
      [IS_REF]: `isRef`
9501
  };
9502
  function registerRuntimeHelpers(helpers) {
9503
      Object.getOwnPropertySymbols(helpers).forEach(s => {
9504
          helperNameMap[s] = helpers[s];
9505
      });
9506
  }
9507
 
9508
  // AST Utilities ---------------------------------------------------------------
9509
  // Some expressions, e.g. sequence and conditional expressions, are never
9510
  // associated with template nodes, so their source locations are just a stub.
9511
  // Container types like CompoundExpression also don't need a real location.
9512
  const locStub = {
9513
      source: '',
9514
      start: { line: 1, column: 1, offset: 0 },
9515
      end: { line: 1, column: 1, offset: 0 }
9516
  };
9517
  function createRoot(children, loc = locStub) {
9518
      return {
9519
          type: 0 /* ROOT */,
9520
          children,
9521
          helpers: [],
9522
          components: [],
9523
          directives: [],
9524
          hoists: [],
9525
          imports: [],
9526
          cached: 0,
9527
          temps: 0,
9528
          codegenNode: undefined,
9529
          loc
9530
      };
9531
  }
9532
  function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, loc = locStub) {
9533
      if (context) {
9534
          if (isBlock) {
9535
              context.helper(OPEN_BLOCK);
9536
              context.helper(CREATE_BLOCK);
9537
          }
9538
          else {
9539
              context.helper(CREATE_VNODE);
9540
          }
9541
          if (directives) {
9542
              context.helper(WITH_DIRECTIVES);
9543
          }
9544
      }
9545
      return {
9546
          type: 13 /* VNODE_CALL */,
9547
          tag,
9548
          props,
9549
          children,
9550
          patchFlag,
9551
          dynamicProps,
9552
          directives,
9553
          isBlock,
9554
          disableTracking,
9555
          loc
9556
      };
9557
  }
9558
  function createArrayExpression(elements, loc = locStub) {
9559
      return {
9560
          type: 17 /* JS_ARRAY_EXPRESSION */,
9561
          loc,
9562
          elements
9563
      };
9564
  }
9565
  function createObjectExpression(properties, loc = locStub) {
9566
      return {
9567
          type: 15 /* JS_OBJECT_EXPRESSION */,
9568
          loc,
9569
          properties
9570
      };
9571
  }
9572
  function createObjectProperty(key, value) {
9573
      return {
9574
          type: 16 /* JS_PROPERTY */,
9575
          loc: locStub,
9576
          key: isString(key) ? createSimpleExpression(key, true) : key,
9577
          value
9578
      };
9579
  }
9580
  function createSimpleExpression(content, isStatic, loc = locStub, constType = 0 /* NOT_CONSTANT */) {
9581
      return {
9582
          type: 4 /* SIMPLE_EXPRESSION */,
9583
          loc,
9584
          content,
9585
          isStatic,
9586
          constType: isStatic ? 3 /* CAN_STRINGIFY */ : constType
9587
      };
9588
  }
9589
  function createCompoundExpression(children, loc = locStub) {
9590
      return {
9591
          type: 8 /* COMPOUND_EXPRESSION */,
9592
          loc,
9593
          children
9594
      };
9595
  }
9596
  function createCallExpression(callee, args = [], loc = locStub) {
9597
      return {
9598
          type: 14 /* JS_CALL_EXPRESSION */,
9599
          loc,
9600
          callee,
9601
          arguments: args
9602
      };
9603
  }
9604
  function createFunctionExpression(params, returns = undefined, newline = false, isSlot = false, loc = locStub) {
9605
      return {
9606
          type: 18 /* JS_FUNCTION_EXPRESSION */,
9607
          params,
9608
          returns,
9609
          newline,
9610
          isSlot,
9611
          loc
9612
      };
9613
  }
9614
  function createConditionalExpression(test, consequent, alternate, newline = true) {
9615
      return {
9616
          type: 19 /* JS_CONDITIONAL_EXPRESSION */,
9617
          test,
9618
          consequent,
9619
          alternate,
9620
          newline,
9621
          loc: locStub
9622
      };
9623
  }
9624
  function createCacheExpression(index, value, isVNode = false) {
9625
      return {
9626
          type: 20 /* JS_CACHE_EXPRESSION */,
9627
          index,
9628
          value,
9629
          isVNode,
9630
          loc: locStub
9631
      };
9632
  }
9633
 
9634
  const isStaticExp = (p) => p.type === 4 /* SIMPLE_EXPRESSION */ && p.isStatic;
9635
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
9636
  function isCoreComponent(tag) {
9637
      if (isBuiltInType(tag, 'Teleport')) {
9638
          return TELEPORT;
9639
      }
9640
      else if (isBuiltInType(tag, 'Suspense')) {
9641
          return SUSPENSE;
9642
      }
9643
      else if (isBuiltInType(tag, 'KeepAlive')) {
9644
          return KEEP_ALIVE;
9645
      }
9646
      else if (isBuiltInType(tag, 'BaseTransition')) {
9647
          return BASE_TRANSITION;
9648
      }
9649
  }
9650
  const nonIdentifierRE = /^\d|[^\$\w]/;
9651
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
9652
  const memberExpRE = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*|\[[^\]]+\])*$/;
9653
  const isMemberExpression = (path) => {
9654
      if (!path)
9655
          return false;
9656
      return memberExpRE.test(path.trim());
9657
  };
9658
  function getInnerRange(loc, offset, length) {
9659
      const source = loc.source.substr(offset, length);
9660
      const newLoc = {
9661
          source,
9662
          start: advancePositionWithClone(loc.start, loc.source, offset),
9663
          end: loc.end
9664
      };
9665
      if (length != null) {
9666
          newLoc.end = advancePositionWithClone(loc.start, loc.source, offset + length);
9667
      }
9668
      return newLoc;
9669
  }
9670
  function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
9671
      return advancePositionWithMutation(extend({}, pos), source, numberOfCharacters);
9672
  }
9673
  // advance by mutation without cloning (for performance reasons), since this
9674
  // gets called a lot in the parser
9675
  function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
9676
      let linesCount = 0;
9677
      let lastNewLinePos = -1;
9678
      for (let i = 0; i < numberOfCharacters; i++) {
9679
          if (source.charCodeAt(i) === 10 /* newline char code */) {
9680
              linesCount++;
9681
              lastNewLinePos = i;
9682
          }
9683
      }
9684
      pos.offset += numberOfCharacters;
9685
      pos.line += linesCount;
9686
      pos.column =
9687
          lastNewLinePos === -1
9688
              ? pos.column + numberOfCharacters
9689
              : numberOfCharacters - lastNewLinePos;
9690
      return pos;
9691
  }
9692
  function assert(condition, msg) {
9693
      /* istanbul ignore if */
9694
      if (!condition) {
9695
          throw new Error(msg || `unexpected compiler condition`);
9696
      }
9697
  }
9698
  function findDir(node, name, allowEmpty = false) {
9699
      for (let i = 0; i < node.props.length; i++) {
9700
          const p = node.props[i];
9701
          if (p.type === 7 /* DIRECTIVE */ &&
9702
              (allowEmpty || p.exp) &&
9703
              (isString(name) ? p.name === name : name.test(p.name))) {
9704
              return p;
9705
          }
9706
      }
9707
  }
9708
  function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
9709
      for (let i = 0; i < node.props.length; i++) {
9710
          const p = node.props[i];
9711
          if (p.type === 6 /* ATTRIBUTE */) {
9712
              if (dynamicOnly)
9713
                  continue;
9714
              if (p.name === name && (p.value || allowEmpty)) {
9715
                  return p;
9716
              }
9717
          }
9718
          else if (p.name === 'bind' &&
9719
              (p.exp || allowEmpty) &&
9720
              isBindKey(p.arg, name)) {
9721
              return p;
9722
          }
9723
      }
9724
  }
9725
  function isBindKey(arg, name) {
9726
      return !!(arg && isStaticExp(arg) && arg.content === name);
9727
  }
9728
  function hasDynamicKeyVBind(node) {
9729
      return node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
9730
          p.name === 'bind' &&
9731
          (!p.arg || // v-bind="obj"
9732
              p.arg.type !== 4 /* SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
9733
              !p.arg.isStatic) // v-bind:[foo]
9734
      );
9735
  }
9736
  function isText(node) {
9737
      return node.type === 5 /* INTERPOLATION */ || node.type === 2 /* TEXT */;
9738
  }
9739
  function isVSlot(p) {
9740
      return p.type === 7 /* DIRECTIVE */ && p.name === 'slot';
9741
  }
9742
  function isTemplateNode(node) {
9743
      return (node.type === 1 /* ELEMENT */ && node.tagType === 3 /* TEMPLATE */);
9744
  }
9745
  function isSlotOutlet(node) {
9746
      return node.type === 1 /* ELEMENT */ && node.tagType === 2 /* SLOT */;
9747
  }
9748
  function injectProp(node, prop, context) {
9749
      let propsWithInjection;
9750
      const props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
9751
      if (props == null || isString(props)) {
9752
          propsWithInjection = createObjectExpression([prop]);
9753
      }
9754
      else if (props.type === 14 /* JS_CALL_EXPRESSION */) {
9755
          // merged props... add ours
9756
          // only inject key to object literal if it's the first argument so that
9757
          // if doesn't override user provided keys
9758
          const first = props.arguments[0];
9759
          if (!isString(first) && first.type === 15 /* JS_OBJECT_EXPRESSION */) {
9760
              first.properties.unshift(prop);
9761
          }
9762
          else {
9763
              if (props.callee === TO_HANDLERS) {
9764
                  // #2366
9765
                  propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
9766
                      createObjectExpression([prop]),
9767
                      props
9768
                  ]);
9769
              }
9770
              else {
9771
                  props.arguments.unshift(createObjectExpression([prop]));
9772
              }
9773
          }
9774
          !propsWithInjection && (propsWithInjection = props);
9775
      }
9776
      else if (props.type === 15 /* JS_OBJECT_EXPRESSION */) {
9777
          let alreadyExists = false;
9778
          // check existing key to avoid overriding user provided keys
9779
          if (prop.key.type === 4 /* SIMPLE_EXPRESSION */) {
9780
              const propKeyName = prop.key.content;
9781
              alreadyExists = props.properties.some(p => p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
9782
                  p.key.content === propKeyName);
9783
          }
9784
          if (!alreadyExists) {
9785
              props.properties.unshift(prop);
9786
          }
9787
          propsWithInjection = props;
9788
      }
9789
      else {
9790
          // single v-bind with expression, return a merged replacement
9791
          propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
9792
              createObjectExpression([prop]),
9793
              props
9794
          ]);
9795
      }
9796
      if (node.type === 13 /* VNODE_CALL */) {
9797
          node.props = propsWithInjection;
9798
      }
9799
      else {
9800
          node.arguments[2] = propsWithInjection;
9801
      }
9802
  }
9803
  function toValidAssetId(name, type) {
9804
      return `_${type}_${name.replace(/[^\w]/g, '_')}`;
9805
  }
9806
 
9807
  // The default decoder only provides escapes for characters reserved as part of
9808
  // the template syntax, and is only used if the custom renderer did not provide
9809
  // a platform-specific decoder.
9810
  const decodeRE = /&(gt|lt|amp|apos|quot);/g;
9811
  const decodeMap = {
9812
      gt: '>',
9813
      lt: '<',
9814
      amp: '&',
9815
      apos: "'",
9816
      quot: '"'
9817
  };
9818
  const defaultParserOptions = {
9819
      delimiters: [`{{`, `}}`],
9820
      getNamespace: () => 0 /* HTML */,
9821
      getTextMode: () => 0 /* DATA */,
9822
      isVoidTag: NO,
9823
      isPreTag: NO,
9824
      isCustomElement: NO,
9825
      decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
9826
      onError: defaultOnError,
9827
      comments: false
9828
  };
9829
  function baseParse(content, options = {}) {
9830
      const context = createParserContext(content, options);
9831
      const start = getCursor(context);
9832
      return createRoot(parseChildren(context, 0 /* DATA */, []), getSelection(context, start));
9833
  }
9834
  function createParserContext(content, rawOptions) {
9835
      const options = extend({}, defaultParserOptions);
9836
      for (const key in rawOptions) {
9837
          // @ts-ignore
9838
          options[key] = rawOptions[key] || defaultParserOptions[key];
9839
      }
9840
      return {
9841
          options,
9842
          column: 1,
9843
          line: 1,
9844
          offset: 0,
9845
          originalSource: content,
9846
          source: content,
9847
          inPre: false,
9848
          inVPre: false
9849
      };
9850
  }
9851
  function parseChildren(context, mode, ancestors) {
9852
      const parent = last(ancestors);
9853
      const ns = parent ? parent.ns : 0 /* HTML */;
9854
      const nodes = [];
9855
      while (!isEnd(context, mode, ancestors)) {
9856
          const s = context.source;
9857
          let node = undefined;
9858
          if (mode === 0 /* DATA */ || mode === 1 /* RCDATA */) {
9859
              if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
9860
                  // '{{'
9861
                  node = parseInterpolation(context, mode);
9862
              }
9863
              else if (mode === 0 /* DATA */ && s[0] === '<') {
9864
                  // https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
9865
                  if (s.length === 1) {
9866
                      emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 1);
9867
                  }
9868
                  else if (s[1] === '!') {
9869
                      // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
9870
                      if (startsWith(s, '<!--')) {
9871
                          node = parseComment(context);
9872
                      }
9873
                      else if (startsWith(s, '<!DOCTYPE')) {
9874
                          // Ignore DOCTYPE by a limitation.
9875
                          node = parseBogusComment(context);
9876
                      }
9877
                      else if (startsWith(s, '<![CDATA[')) {
9878
                          if (ns !== 0 /* HTML */) {
9879
                              node = parseCDATA(context, ancestors);
9880
                          }
9881
                          else {
9882
                              emitError(context, 1 /* CDATA_IN_HTML_CONTENT */);
9883
                              node = parseBogusComment(context);
9884
                          }
9885
                      }
9886
                      else {
9887
                          emitError(context, 11 /* INCORRECTLY_OPENED_COMMENT */);
9888
                          node = parseBogusComment(context);
9889
                      }
9890
                  }
9891
                  else if (s[1] === '/') {
9892
                      // https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
9893
                      if (s.length === 2) {
9894
                          emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 2);
9895
                      }
9896
                      else if (s[2] === '>') {
9897
                          emitError(context, 14 /* MISSING_END_TAG_NAME */, 2);
9898
                          advanceBy(context, 3);
9899
                          continue;
9900
                      }
9901
                      else if (/[a-z]/i.test(s[2])) {
9902
                          emitError(context, 23 /* X_INVALID_END_TAG */);
9903
                          parseTag(context, 1 /* End */, parent);
9904
                          continue;
9905
                      }
9906
                      else {
9907
                          emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
9908
                          node = parseBogusComment(context);
9909
                      }
9910
                  }
9911
                  else if (/[a-z]/i.test(s[1])) {
9912
                      node = parseElement(context, ancestors);
9913
                  }
9914
                  else if (s[1] === '?') {
9915
                      emitError(context, 21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
9916
                      node = parseBogusComment(context);
9917
                  }
9918
                  else {
9919
                      emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
9920
                  }
9921
              }
9922
          }
9923
          if (!node) {
9924
              node = parseText(context, mode);
9925
          }
9926
          if (isArray(node)) {
9927
              for (let i = 0; i < node.length; i++) {
9928
                  pushNode(nodes, node[i]);
9929
              }
9930
          }
9931
          else {
9932
              pushNode(nodes, node);
9933
          }
9934
      }
9935
      // Whitespace management for more efficient output
9936
      // (same as v2 whitespace: 'condense')
9937
      let removedWhitespace = false;
9938
      if (mode !== 2 /* RAWTEXT */) {
9939
          for (let i = 0; i < nodes.length; i++) {
9940
              const node = nodes[i];
9941
              if (!context.inPre && node.type === 2 /* TEXT */) {
9942
                  if (!/[^\t\r\n\f ]/.test(node.content)) {
9943
                      const prev = nodes[i - 1];
9944
                      const next = nodes[i + 1];
9945
                      // If:
9946
                      // - the whitespace is the first or last node, or:
9947
                      // - the whitespace is adjacent to a comment, or:
9948
                      // - the whitespace is between two elements AND contains newline
9949
                      // Then the whitespace is ignored.
9950
                      if (!prev ||
9951
                          !next ||
9952
                          prev.type === 3 /* COMMENT */ ||
9953
                          next.type === 3 /* COMMENT */ ||
9954
                          (prev.type === 1 /* ELEMENT */ &&
9955
                              next.type === 1 /* ELEMENT */ &&
9956
                              /[\r\n]/.test(node.content))) {
9957
                          removedWhitespace = true;
9958
                          nodes[i] = null;
9959
                      }
9960
                      else {
9961
                          // Otherwise, condensed consecutive whitespace inside the text
9962
                          // down to a single space
9963
                          node.content = ' ';
9964
                      }
9965
                  }
9966
                  else {
9967
                      node.content = node.content.replace(/[\t\r\n\f ]+/g, ' ');
9968
                  }
9969
              }
9970
          }
9971
          if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
9972
              // remove leading newline per html spec
9973
              // https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
9974
              const first = nodes[0];
9975
              if (first && first.type === 2 /* TEXT */) {
9976
                  first.content = first.content.replace(/^\r?\n/, '');
9977
              }
9978
          }
9979
      }
9980
      return removedWhitespace ? nodes.filter(Boolean) : nodes;
9981
  }
9982
  function pushNode(nodes, node) {
9983
      if (node.type === 2 /* TEXT */) {
9984
          const prev = last(nodes);
9985
          // Merge if both this and the previous node are text and those are
9986
          // consecutive. This happens for cases like "a < b".
9987
          if (prev &&
9988
              prev.type === 2 /* TEXT */ &&
9989
              prev.loc.end.offset === node.loc.start.offset) {
9990
              prev.content += node.content;
9991
              prev.loc.end = node.loc.end;
9992
              prev.loc.source += node.loc.source;
9993
              return;
9994
          }
9995
      }
9996
      nodes.push(node);
9997
  }
9998
  function parseCDATA(context, ancestors) {
9999
      advanceBy(context, 9);
10000
      const nodes = parseChildren(context, 3 /* CDATA */, ancestors);
10001
      if (context.source.length === 0) {
10002
          emitError(context, 6 /* EOF_IN_CDATA */);
10003
      }
10004
      else {
10005
          advanceBy(context, 3);
10006
      }
10007
      return nodes;
10008
  }
10009
  function parseComment(context) {
10010
      const start = getCursor(context);
10011
      let content;
10012
      // Regular comment.
10013
      const match = /--(\!)?>/.exec(context.source);
10014
      if (!match) {
10015
          content = context.source.slice(4);
10016
          advanceBy(context, context.source.length);
10017
          emitError(context, 7 /* EOF_IN_COMMENT */);
10018
      }
10019
      else {
10020
          if (match.index <= 3) {
10021
              emitError(context, 0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
10022
          }
10023
          if (match[1]) {
10024
              emitError(context, 10 /* INCORRECTLY_CLOSED_COMMENT */);
10025
          }
10026
          content = context.source.slice(4, match.index);
10027
          // Advancing with reporting nested comments.
10028
          const s = context.source.slice(0, match.index);
10029
          let prevIndex = 1, nestedIndex = 0;
10030
          while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
10031
              advanceBy(context, nestedIndex - prevIndex + 1);
10032
              if (nestedIndex + 4 < s.length) {
10033
                  emitError(context, 16 /* NESTED_COMMENT */);
10034
              }
10035
              prevIndex = nestedIndex + 1;
10036
          }
10037
          advanceBy(context, match.index + match[0].length - prevIndex + 1);
10038
      }
10039
      return {
10040
          type: 3 /* COMMENT */,
10041
          content,
10042
          loc: getSelection(context, start)
10043
      };
10044
  }
10045
  function parseBogusComment(context) {
10046
      const start = getCursor(context);
10047
      const contentStart = context.source[1] === '?' ? 1 : 2;
10048
      let content;
10049
      const closeIndex = context.source.indexOf('>');
10050
      if (closeIndex === -1) {
10051
          content = context.source.slice(contentStart);
10052
          advanceBy(context, context.source.length);
10053
      }
10054
      else {
10055
          content = context.source.slice(contentStart, closeIndex);
10056
          advanceBy(context, closeIndex + 1);
10057
      }
10058
      return {
10059
          type: 3 /* COMMENT */,
10060
          content,
10061
          loc: getSelection(context, start)
10062
      };
10063
  }
10064
  function parseElement(context, ancestors) {
10065
      // Start tag.
10066
      const wasInPre = context.inPre;
10067
      const wasInVPre = context.inVPre;
10068
      const parent = last(ancestors);
10069
      const element = parseTag(context, 0 /* Start */, parent);
10070
      const isPreBoundary = context.inPre && !wasInPre;
10071
      const isVPreBoundary = context.inVPre && !wasInVPre;
10072
      if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
10073
          return element;
10074
      }
10075
      // Children.
10076
      ancestors.push(element);
10077
      const mode = context.options.getTextMode(element, parent);
10078
      const children = parseChildren(context, mode, ancestors);
10079
      ancestors.pop();
10080
      element.children = children;
10081
      // End tag.
10082
      if (startsWithEndTagOpen(context.source, element.tag)) {
10083
          parseTag(context, 1 /* End */, parent);
10084
      }
10085
      else {
10086
          emitError(context, 24 /* X_MISSING_END_TAG */, 0, element.loc.start);
10087
          if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
10088
              const first = children[0];
10089
              if (first && startsWith(first.loc.source, '<!--')) {
10090
                  emitError(context, 8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
10091
              }
10092
          }
10093
      }
10094
      element.loc = getSelection(context, element.loc.start);
10095
      if (isPreBoundary) {
10096
          context.inPre = false;
10097
      }
10098
      if (isVPreBoundary) {
10099
          context.inVPre = false;
10100
      }
10101
      return element;
10102
  }
10103
  const isSpecialTemplateDirective = /*#__PURE__*/ makeMap(`if,else,else-if,for,slot`);
10104
  /**
10105
   * Parse a tag (E.g. `<div id=a>`) with that type (start tag or end tag).
10106
   */
10107
  function parseTag(context, type, parent) {
10108
      // Tag open.
10109
      const start = getCursor(context);
10110
      const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
10111
      const tag = match[1];
10112
      const ns = context.options.getNamespace(tag, parent);
10113
      advanceBy(context, match[0].length);
10114
      advanceSpaces(context);
10115
      // save current state in case we need to re-parse attributes with v-pre
10116
      const cursor = getCursor(context);
10117
      const currentSource = context.source;
10118
      // Attributes.
10119
      let props = parseAttributes(context, type);
10120
      // check <pre> tag
10121
      if (context.options.isPreTag(tag)) {
10122
          context.inPre = true;
10123
      }
10124
      // check v-pre
10125
      if (!context.inVPre &&
10126
          props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
10127
          context.inVPre = true;
10128
          // reset context
10129
          extend(context, cursor);
10130
          context.source = currentSource;
10131
          // re-parse attrs and filter out v-pre itself
10132
          props = parseAttributes(context, type).filter(p => p.name !== 'v-pre');
10133
      }
10134
      // Tag close.
10135
      let isSelfClosing = false;
10136
      if (context.source.length === 0) {
10137
          emitError(context, 9 /* EOF_IN_TAG */);
10138
      }
10139
      else {
10140
          isSelfClosing = startsWith(context.source, '/>');
10141
          if (type === 1 /* End */ && isSelfClosing) {
10142
              emitError(context, 4 /* END_TAG_WITH_TRAILING_SOLIDUS */);
10143
          }
10144
          advanceBy(context, isSelfClosing ? 2 : 1);
10145
      }
10146
      let tagType = 0 /* ELEMENT */;
10147
      const options = context.options;
10148
      if (!context.inVPre && !options.isCustomElement(tag)) {
10149
          const hasVIs = props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'is');
10150
          if (options.isNativeTag && !hasVIs) {
10151
              if (!options.isNativeTag(tag))
10152
                  tagType = 1 /* COMPONENT */;
10153
          }
10154
          else if (hasVIs ||
10155
              isCoreComponent(tag) ||
10156
              (options.isBuiltInComponent && options.isBuiltInComponent(tag)) ||
10157
              /^[A-Z]/.test(tag) ||
10158
              tag === 'component') {
10159
              tagType = 1 /* COMPONENT */;
10160
          }
10161
          if (tag === 'slot') {
10162
              tagType = 2 /* SLOT */;
10163
          }
10164
          else if (tag === 'template' &&
10165
              props.some(p => {
10166
                  return (p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name));
10167
              })) {
10168
              tagType = 3 /* TEMPLATE */;
10169
          }
10170
      }
10171
      return {
10172
          type: 1 /* ELEMENT */,
10173
          ns,
10174
          tag,
10175
          tagType,
10176
          props,
10177
          isSelfClosing,
10178
          children: [],
10179
          loc: getSelection(context, start),
10180
          codegenNode: undefined // to be created during transform phase
10181
      };
10182
  }
10183
  function parseAttributes(context, type) {
10184
      const props = [];
10185
      const attributeNames = new Set();
10186
      while (context.source.length > 0 &&
10187
          !startsWith(context.source, '>') &&
10188
          !startsWith(context.source, '/>')) {
10189
          if (startsWith(context.source, '/')) {
10190
              emitError(context, 22 /* UNEXPECTED_SOLIDUS_IN_TAG */);
10191
              advanceBy(context, 1);
10192
              advanceSpaces(context);
10193
              continue;
10194
          }
10195
          if (type === 1 /* End */) {
10196
              emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
10197
          }
10198
          const attr = parseAttribute(context, attributeNames);
10199
          if (type === 0 /* Start */) {
10200
              props.push(attr);
10201
          }
10202
          if (/^[^\t\r\n\f />]/.test(context.source)) {
10203
              emitError(context, 15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
10204
          }
10205
          advanceSpaces(context);
10206
      }
10207
      return props;
10208
  }
10209
  function parseAttribute(context, nameSet) {
10210
      // Name.
10211
      const start = getCursor(context);
10212
      const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
10213
      const name = match[0];
10214
      if (nameSet.has(name)) {
10215
          emitError(context, 2 /* DUPLICATE_ATTRIBUTE */);
10216
      }
10217
      nameSet.add(name);
10218
      if (name[0] === '=') {
10219
          emitError(context, 19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
10220
      }
10221
      {
10222
          const pattern = /["'<]/g;
10223
          let m;
10224
          while ((m = pattern.exec(name))) {
10225
              emitError(context, 17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
10226
          }
10227
      }
10228
      advanceBy(context, name.length);
10229
      // Value
10230
      let value = undefined;
10231
      if (/^[\t\r\n\f ]*=/.test(context.source)) {
10232
          advanceSpaces(context);
10233
          advanceBy(context, 1);
10234
          advanceSpaces(context);
10235
          value = parseAttributeValue(context);
10236
          if (!value) {
10237
              emitError(context, 13 /* MISSING_ATTRIBUTE_VALUE */);
10238
          }
10239
      }
10240
      const loc = getSelection(context, start);
10241
      if (!context.inVPre && /^(v-|:|@|#)/.test(name)) {
10242
          const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
10243
          const dirName = match[1] ||
10244
              (startsWith(name, ':') ? 'bind' : startsWith(name, '@') ? 'on' : 'slot');
10245
          let arg;
10246
          if (match[2]) {
10247
              const isSlot = dirName === 'slot';
10248
              const startOffset = name.indexOf(match[2]);
10249
              const loc = getSelection(context, getNewPosition(context, start, startOffset), getNewPosition(context, start, startOffset + match[2].length + ((isSlot && match[3]) || '').length));
10250
              let content = match[2];
10251
              let isStatic = true;
10252
              if (content.startsWith('[')) {
10253
                  isStatic = false;
10254
                  if (!content.endsWith(']')) {
10255
                      emitError(context, 26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
10256
                  }
10257
                  content = content.substr(1, content.length - 2);
10258
              }
10259
              else if (isSlot) {
10260
                  // #1241 special case for v-slot: vuetify relies extensively on slot
10261
                  // names containing dots. v-slot doesn't have any modifiers and Vue 2.x
10262
                  // supports such usage so we are keeping it consistent with 2.x.
10263
                  content += match[3] || '';
10264
              }
10265
              arg = {
10266
                  type: 4 /* SIMPLE_EXPRESSION */,
10267
                  content,
10268
                  isStatic,
10269
                  constType: isStatic
10270
                      ? 3 /* CAN_STRINGIFY */
10271
                      : 0 /* NOT_CONSTANT */,
10272
                  loc
10273
              };
10274
          }
10275
          if (value && value.isQuoted) {
10276
              const valueLoc = value.loc;
10277
              valueLoc.start.offset++;
10278
              valueLoc.start.column++;
10279
              valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
10280
              valueLoc.source = valueLoc.source.slice(1, -1);
10281
          }
10282
          return {
10283
              type: 7 /* DIRECTIVE */,
10284
              name: dirName,
10285
              exp: value && {
10286
                  type: 4 /* SIMPLE_EXPRESSION */,
10287
                  content: value.content,
10288
                  isStatic: false,
10289
                  // Treat as non-constant by default. This can be potentially set to
10290
                  // other values by `transformExpression` to make it eligible for hoisting.
10291
                  constType: 0 /* NOT_CONSTANT */,
10292
                  loc: value.loc
10293
              },
10294
              arg,
10295
              modifiers: match[3] ? match[3].substr(1).split('.') : [],
10296
              loc
10297
          };
10298
      }
10299
      return {
10300
          type: 6 /* ATTRIBUTE */,
10301
          name,
10302
          value: value && {
10303
              type: 2 /* TEXT */,
10304
              content: value.content,
10305
              loc: value.loc
10306
          },
10307
          loc
10308
      };
10309
  }
10310
  function parseAttributeValue(context) {
10311
      const start = getCursor(context);
10312
      let content;
10313
      const quote = context.source[0];
10314
      const isQuoted = quote === `"` || quote === `'`;
10315
      if (isQuoted) {
10316
          // Quoted value.
10317
          advanceBy(context, 1);
10318
          const endIndex = context.source.indexOf(quote);
10319
          if (endIndex === -1) {
10320
              content = parseTextData(context, context.source.length, 4 /* ATTRIBUTE_VALUE */);
10321
          }
10322
          else {
10323
              content = parseTextData(context, endIndex, 4 /* ATTRIBUTE_VALUE */);
10324
              advanceBy(context, 1);
10325
          }
10326
      }
10327
      else {
10328
          // Unquoted
10329
          const match = /^[^\t\r\n\f >]+/.exec(context.source);
10330
          if (!match) {
10331
              return undefined;
10332
          }
10333
          const unexpectedChars = /["'<=`]/g;
10334
          let m;
10335
          while ((m = unexpectedChars.exec(match[0]))) {
10336
              emitError(context, 18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
10337
          }
10338
          content = parseTextData(context, match[0].length, 4 /* ATTRIBUTE_VALUE */);
10339
      }
10340
      return { content, isQuoted, loc: getSelection(context, start) };
10341
  }
10342
  function parseInterpolation(context, mode) {
10343
      const [open, close] = context.options.delimiters;
10344
      const closeIndex = context.source.indexOf(close, open.length);
10345
      if (closeIndex === -1) {
10346
          emitError(context, 25 /* X_MISSING_INTERPOLATION_END */);
10347
          return undefined;
10348
      }
10349
      const start = getCursor(context);
10350
      advanceBy(context, open.length);
10351
      const innerStart = getCursor(context);
10352
      const innerEnd = getCursor(context);
10353
      const rawContentLength = closeIndex - open.length;
10354
      const rawContent = context.source.slice(0, rawContentLength);
10355
      const preTrimContent = parseTextData(context, rawContentLength, mode);
10356
      const content = preTrimContent.trim();
10357
      const startOffset = preTrimContent.indexOf(content);
10358
      if (startOffset > 0) {
10359
          advancePositionWithMutation(innerStart, rawContent, startOffset);
10360
      }
10361
      const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
10362
      advancePositionWithMutation(innerEnd, rawContent, endOffset);
10363
      advanceBy(context, close.length);
10364
      return {
10365
          type: 5 /* INTERPOLATION */,
10366
          content: {
10367
              type: 4 /* SIMPLE_EXPRESSION */,
10368
              isStatic: false,
10369
              // Set `isConstant` to false by default and will decide in transformExpression
10370
              constType: 0 /* NOT_CONSTANT */,
10371
              content,
10372
              loc: getSelection(context, innerStart, innerEnd)
10373
          },
10374
          loc: getSelection(context, start)
10375
      };
10376
  }
10377
  function parseText(context, mode) {
10378
      const endTokens = ['<', context.options.delimiters[0]];
10379
      if (mode === 3 /* CDATA */) {
10380
          endTokens.push(']]>');
10381
      }
10382
      let endIndex = context.source.length;
10383
      for (let i = 0; i < endTokens.length; i++) {
10384
          const index = context.source.indexOf(endTokens[i], 1);
10385
          if (index !== -1 && endIndex > index) {
10386
              endIndex = index;
10387
          }
10388
      }
10389
      const start = getCursor(context);
10390
      const content = parseTextData(context, endIndex, mode);
10391
      return {
10392
          type: 2 /* TEXT */,
10393
          content,
10394
          loc: getSelection(context, start)
10395
      };
10396
  }
10397
  /**
10398
   * Get text data with a given length from the current location.
10399
   * This translates HTML entities in the text data.
10400
   */
10401
  function parseTextData(context, length, mode) {
10402
      const rawText = context.source.slice(0, length);
10403
      advanceBy(context, length);
10404
      if (mode === 2 /* RAWTEXT */ ||
10405
          mode === 3 /* CDATA */ ||
10406
          rawText.indexOf('&') === -1) {
10407
          return rawText;
10408
      }
10409
      else {
10410
          // DATA or RCDATA containing "&"". Entity decoding required.
10411
          return context.options.decodeEntities(rawText, mode === 4 /* ATTRIBUTE_VALUE */);
10412
      }
10413
  }
10414
  function getCursor(context) {
10415
      const { column, line, offset } = context;
10416
      return { column, line, offset };
10417
  }
10418
  function getSelection(context, start, end) {
10419
      end = end || getCursor(context);
10420
      return {
10421
          start,
10422
          end,
10423
          source: context.originalSource.slice(start.offset, end.offset)
10424
      };
10425
  }
10426
  function last(xs) {
10427
      return xs[xs.length - 1];
10428
  }
10429
  function startsWith(source, searchString) {
10430
      return source.startsWith(searchString);
10431
  }
10432
  function advanceBy(context, numberOfCharacters) {
10433
      const { source } = context;
10434
      advancePositionWithMutation(context, source, numberOfCharacters);
10435
      context.source = source.slice(numberOfCharacters);
10436
  }
10437
  function advanceSpaces(context) {
10438
      const match = /^[\t\r\n\f ]+/.exec(context.source);
10439
      if (match) {
10440
          advanceBy(context, match[0].length);
10441
      }
10442
  }
10443
  function getNewPosition(context, start, numberOfCharacters) {
10444
      return advancePositionWithClone(start, context.originalSource.slice(start.offset, numberOfCharacters), numberOfCharacters);
10445
  }
10446
  function emitError(context, code, offset, loc = getCursor(context)) {
10447
      if (offset) {
10448
          loc.offset += offset;
10449
          loc.column += offset;
10450
      }
10451
      context.options.onError(createCompilerError(code, {
10452
          start: loc,
10453
          end: loc,
10454
          source: ''
10455
      }));
10456
  }
10457
  function isEnd(context, mode, ancestors) {
10458
      const s = context.source;
10459
      switch (mode) {
10460
          case 0 /* DATA */:
10461
              if (startsWith(s, '</')) {
10462
                  //TODO: probably bad performance
10463
                  for (let i = ancestors.length - 1; i >= 0; --i) {
10464
                      if (startsWithEndTagOpen(s, ancestors[i].tag)) {
10465
                          return true;
10466
                      }
10467
                  }
10468
              }
10469
              break;
10470
          case 1 /* RCDATA */:
10471
          case 2 /* RAWTEXT */: {
10472
              const parent = last(ancestors);
10473
              if (parent && startsWithEndTagOpen(s, parent.tag)) {
10474
                  return true;
10475
              }
10476
              break;
10477
          }
10478
          case 3 /* CDATA */:
10479
              if (startsWith(s, ']]>')) {
10480
                  return true;
10481
              }
10482
              break;
10483
      }
10484
      return !s;
10485
  }
10486
  function startsWithEndTagOpen(source, tag) {
10487
      return (startsWith(source, '</') &&
10488
          source.substr(2, tag.length).toLowerCase() === tag.toLowerCase() &&
10489
          /[\t\r\n\f />]/.test(source[2 + tag.length] || '>'));
10490
  }
10491
 
10492
  function hoistStatic(root, context) {
10493
      walk(root, context,
10494
      // Root node is unfortunately non-hoistable due to potential parent
10495
      // fallthrough attributes.
10496
      isSingleElementRoot(root, root.children[0]));
10497
  }
10498
  function isSingleElementRoot(root, child) {
10499
      const { children } = root;
10500
      return (children.length === 1 &&
10501
          child.type === 1 /* ELEMENT */ &&
10502
          !isSlotOutlet(child));
10503
  }
10504
  function walk(node, context, doNotHoistNode = false) {
10505
      let hasHoistedNode = false;
10506
      // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
10507
      // static bindings with expressions. These expressions are guaranteed to be
10508
      // constant so they are still eligible for hoisting, but they are only
10509
      // available at runtime and therefore cannot be evaluated ahead of time.
10510
      // This is only a concern for pre-stringification (via transformHoist by
10511
      // @vue/compiler-dom), but doing it here allows us to perform only one full
10512
      // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
10513
      // stringficiation threshold is met.
10514
      let canStringify = true;
10515
      const { children } = node;
10516
      for (let i = 0; i < children.length; i++) {
10517
          const child = children[i];
10518
          // only plain elements & text calls are eligible for hoisting.
10519
          if (child.type === 1 /* ELEMENT */ &&
10520
              child.tagType === 0 /* ELEMENT */) {
10521
              const constantType = doNotHoistNode
10522
                  ? 0 /* NOT_CONSTANT */
10523
                  : getConstantType(child, context);
10524
              if (constantType > 0 /* NOT_CONSTANT */) {
10525
                  if (constantType < 3 /* CAN_STRINGIFY */) {
10526
                      canStringify = false;
10527
                  }
10528
                  if (constantType >= 2 /* CAN_HOIST */) {
10529
                      child.codegenNode.patchFlag =
10530
                          -1 /* HOISTED */ + ( ` /* HOISTED */` );
10531
                      child.codegenNode = context.hoist(child.codegenNode);
10532
                      hasHoistedNode = true;
10533
                      continue;
10534
                  }
10535
              }
10536
              else {
10537
                  // node may contain dynamic children, but its props may be eligible for
10538
                  // hoisting.
10539
                  const codegenNode = child.codegenNode;
10540
                  if (codegenNode.type === 13 /* VNODE_CALL */) {
10541
                      const flag = getPatchFlag(codegenNode);
10542
                      if ((!flag ||
10543
                          flag === 512 /* NEED_PATCH */ ||
10544
                          flag === 1 /* TEXT */) &&
10545
                          getGeneratedPropsConstantType(child, context) >=
10546
                              2 /* CAN_HOIST */) {
10547
                          const props = getNodeProps(child);
10548
                          if (props) {
10549
                              codegenNode.props = context.hoist(props);
10550
                          }
10551
                      }
10552
                  }
10553
              }
10554
          }
10555
          else if (child.type === 12 /* TEXT_CALL */) {
10556
              const contentType = getConstantType(child.content, context);
10557
              if (contentType > 0) {
10558
                  if (contentType < 3 /* CAN_STRINGIFY */) {
10559
                      canStringify = false;
10560
                  }
10561
                  if (contentType >= 2 /* CAN_HOIST */) {
10562
                      child.codegenNode = context.hoist(child.codegenNode);
10563
                      hasHoistedNode = true;
10564
                  }
10565
              }
10566
          }
10567
          // walk further
10568
          if (child.type === 1 /* ELEMENT */) {
10569
              walk(child, context);
10570
          }
10571
          else if (child.type === 11 /* FOR */) {
10572
              // Do not hoist v-for single child because it has to be a block
10573
              walk(child, context, child.children.length === 1);
10574
          }
10575
          else if (child.type === 9 /* IF */) {
10576
              for (let i = 0; i < child.branches.length; i++) {
10577
                  // Do not hoist v-if single child because it has to be a block
10578
                  walk(child.branches[i], context, child.branches[i].children.length === 1);
10579
              }
10580
          }
10581
      }
10582
      if (canStringify && hasHoistedNode && context.transformHoist) {
10583
          context.transformHoist(children, context, node);
10584
      }
10585
  }
10586
  function getConstantType(node, context) {
10587
      const { constantCache } = context;
10588
      switch (node.type) {
10589
          case 1 /* ELEMENT */:
10590
              if (node.tagType !== 0 /* ELEMENT */) {
10591
                  return 0 /* NOT_CONSTANT */;
10592
              }
10593
              const cached = constantCache.get(node);
10594
              if (cached !== undefined) {
10595
                  return cached;
10596
              }
10597
              const codegenNode = node.codegenNode;
10598
              if (codegenNode.type !== 13 /* VNODE_CALL */) {
10599
                  return 0 /* NOT_CONSTANT */;
10600
              }
10601
              const flag = getPatchFlag(codegenNode);
10602
              if (!flag) {
10603
                  let returnType = 3 /* CAN_STRINGIFY */;
10604
                  // Element itself has no patch flag. However we still need to check:
10605
                  // 1. Even for a node with no patch flag, it is possible for it to contain
10606
                  // non-hoistable expressions that refers to scope variables, e.g. compiler
10607
                  // injected keys or cached event handlers. Therefore we need to always
10608
                  // check the codegenNode's props to be sure.
10609
                  const generatedPropsType = getGeneratedPropsConstantType(node, context);
10610
                  if (generatedPropsType === 0 /* NOT_CONSTANT */) {
10611
                      constantCache.set(node, 0 /* NOT_CONSTANT */);
10612
                      return 0 /* NOT_CONSTANT */;
10613
                  }
10614
                  if (generatedPropsType < returnType) {
10615
                      returnType = generatedPropsType;
10616
                  }
10617
                  // 2. its children.
10618
                  for (let i = 0; i < node.children.length; i++) {
10619
                      const childType = getConstantType(node.children[i], context);
10620
                      if (childType === 0 /* NOT_CONSTANT */) {
10621
                          constantCache.set(node, 0 /* NOT_CONSTANT */);
10622
                          return 0 /* NOT_CONSTANT */;
10623
                      }
10624
                      if (childType < returnType) {
10625
                          returnType = childType;
10626
                      }
10627
                  }
10628
                  // 3. if the type is not already CAN_SKIP_PATCH which is the lowest non-0
10629
                  // type, check if any of the props can cause the type to be lowered
10630
                  // we can skip can_patch because it's guaranteed by the absence of a
10631
                  // patchFlag.
10632
                  if (returnType > 1 /* CAN_SKIP_PATCH */) {
10633
                      for (let i = 0; i < node.props.length; i++) {
10634
                          const p = node.props[i];
10635
                          if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind' && p.exp) {
10636
                              const expType = getConstantType(p.exp, context);
10637
                              if (expType === 0 /* NOT_CONSTANT */) {
10638
                                  constantCache.set(node, 0 /* NOT_CONSTANT */);
10639
                                  return 0 /* NOT_CONSTANT */;
10640
                              }
10641
                              if (expType < returnType) {
10642
                                  returnType = expType;
10643
                              }
10644
                          }
10645
                      }
10646
                  }
10647
                  // only svg/foreignObject could be block here, however if they are
10648
                  // static then they don't need to be blocks since there will be no
10649
                  // nested updates.
10650
                  if (codegenNode.isBlock) {
10651
                      codegenNode.isBlock = false;
10652
                      context.helper(CREATE_VNODE);
10653
                  }
10654
                  constantCache.set(node, returnType);
10655
                  return returnType;
10656
              }
10657
              else {
10658
                  constantCache.set(node, 0 /* NOT_CONSTANT */);
10659
                  return 0 /* NOT_CONSTANT */;
10660
              }
10661
          case 2 /* TEXT */:
10662
          case 3 /* COMMENT */:
10663
              return 3 /* CAN_STRINGIFY */;
10664
          case 9 /* IF */:
10665
          case 11 /* FOR */:
10666
          case 10 /* IF_BRANCH */:
10667
              return 0 /* NOT_CONSTANT */;
10668
          case 5 /* INTERPOLATION */:
10669
          case 12 /* TEXT_CALL */:
10670
              return getConstantType(node.content, context);
10671
          case 4 /* SIMPLE_EXPRESSION */:
10672
              return node.constType;
10673
          case 8 /* COMPOUND_EXPRESSION */:
10674
              let returnType = 3 /* CAN_STRINGIFY */;
10675
              for (let i = 0; i < node.children.length; i++) {
10676
                  const child = node.children[i];
10677
                  if (isString(child) || isSymbol(child)) {
10678
                      continue;
10679
                  }
10680
                  const childType = getConstantType(child, context);
10681
                  if (childType === 0 /* NOT_CONSTANT */) {
10682
                      return 0 /* NOT_CONSTANT */;
10683
                  }
10684
                  else if (childType < returnType) {
10685
                      returnType = childType;
10686
                  }
10687
              }
10688
              return returnType;
10689
          default:
10690
              return 0 /* NOT_CONSTANT */;
10691
      }
10692
  }
10693
  function getGeneratedPropsConstantType(node, context) {
10694
      let returnType = 3 /* CAN_STRINGIFY */;
10695
      const props = getNodeProps(node);
10696
      if (props && props.type === 15 /* JS_OBJECT_EXPRESSION */) {
10697
          const { properties } = props;
10698
          for (let i = 0; i < properties.length; i++) {
10699
              const { key, value } = properties[i];
10700
              const keyType = getConstantType(key, context);
10701
              if (keyType === 0 /* NOT_CONSTANT */) {
10702
                  return keyType;
10703
              }
10704
              if (keyType < returnType) {
10705
                  returnType = keyType;
10706
              }
10707
              if (value.type !== 4 /* SIMPLE_EXPRESSION */) {
10708
                  return 0 /* NOT_CONSTANT */;
10709
              }
10710
              const valueType = getConstantType(value, context);
10711
              if (valueType === 0 /* NOT_CONSTANT */) {
10712
                  return valueType;
10713
              }
10714
              if (valueType < returnType) {
10715
                  returnType = valueType;
10716
              }
10717
          }
10718
      }
10719
      return returnType;
10720
  }
10721
  function getNodeProps(node) {
10722
      const codegenNode = node.codegenNode;
10723
      if (codegenNode.type === 13 /* VNODE_CALL */) {
10724
          return codegenNode.props;
10725
      }
10726
  }
10727
  function getPatchFlag(node) {
10728
      const flag = node.patchFlag;
10729
      return flag ? parseInt(flag, 10) : undefined;
10730
  }
10731
 
10732
  function createTransformContext(root, { filename = '', prefixIdentifiers = false, hoistStatic = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, ssr = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError }) {
10733
      const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/);
10734
      const context = {
10735
          // options
10736
          selfName: nameMatch && capitalize(camelize(nameMatch[1])),
10737
          prefixIdentifiers,
10738
          hoistStatic,
10739
          cacheHandlers,
10740
          nodeTransforms,
10741
          directiveTransforms,
10742
          transformHoist,
10743
          isBuiltInComponent,
10744
          isCustomElement,
10745
          expressionPlugins,
10746
          scopeId,
10747
          ssr,
10748
          ssrCssVars,
10749
          bindingMetadata,
10750
          inline,
10751
          isTS,
10752
          onError,
10753
          // state
10754
          root,
10755
          helpers: new Set(),
10756
          components: new Set(),
10757
          directives: new Set(),
10758
          hoists: [],
10759
          imports: new Set(),
10760
          constantCache: new Map(),
10761
          temps: 0,
10762
          cached: 0,
10763
          identifiers: Object.create(null),
10764
          scopes: {
10765
              vFor: 0,
10766
              vSlot: 0,
10767
              vPre: 0,
10768
              vOnce: 0
10769
          },
10770
          parent: null,
10771
          currentNode: root,
10772
          childIndex: 0,
10773
          // methods
10774
          helper(name) {
10775
              context.helpers.add(name);
10776
              return name;
10777
          },
10778
          helperString(name) {
10779
              return `_${helperNameMap[context.helper(name)]}`;
10780
          },
10781
          replaceNode(node) {
10782
              /* istanbul ignore if */
10783
              {
10784
                  if (!context.currentNode) {
10785
                      throw new Error(`Node being replaced is already removed.`);
10786
                  }
10787
                  if (!context.parent) {
10788
                      throw new Error(`Cannot replace root node.`);
10789
                  }
10790
              }
10791
              context.parent.children[context.childIndex] = context.currentNode = node;
10792
          },
10793
          removeNode(node) {
10794
              if ( !context.parent) {
10795
                  throw new Error(`Cannot remove root node.`);
10796
              }
10797
              const list = context.parent.children;
10798
              const removalIndex = node
10799
                  ? list.indexOf(node)
10800
                  : context.currentNode
10801
                      ? context.childIndex
10802
                      : -1;
10803
              /* istanbul ignore if */
10804
              if ( removalIndex < 0) {
10805
                  throw new Error(`node being removed is not a child of current parent`);
10806
              }
10807
              if (!node || node === context.currentNode) {
10808
                  // current node removed
10809
                  context.currentNode = null;
10810
                  context.onNodeRemoved();
10811
              }
10812
              else {
10813
                  // sibling node removed
10814
                  if (context.childIndex > removalIndex) {
10815
                      context.childIndex--;
10816
                      context.onNodeRemoved();
10817
                  }
10818
              }
10819
              context.parent.children.splice(removalIndex, 1);
10820
          },
10821
          onNodeRemoved: () => { },
10822
          addIdentifiers(exp) {
10823
          },
10824
          removeIdentifiers(exp) {
10825
          },
10826
          hoist(exp) {
10827
              context.hoists.push(exp);
10828
              const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* CAN_HOIST */);
10829
              identifier.hoisted = exp;
10830
              return identifier;
10831
          },
10832
          cache(exp, isVNode = false) {
10833
              return createCacheExpression(++context.cached, exp, isVNode);
10834
          }
10835
      };
10836
      return context;
10837
  }
10838
  function transform(root, options) {
10839
      const context = createTransformContext(root, options);
10840
      traverseNode(root, context);
10841
      if (options.hoistStatic) {
10842
          hoistStatic(root, context);
10843
      }
10844
      if (!options.ssr) {
10845
          createRootCodegen(root, context);
10846
      }
10847
      // finalize meta information
10848
      root.helpers = [...context.helpers];
10849
      root.components = [...context.components];
10850
      root.directives = [...context.directives];
10851
      root.imports = [...context.imports];
10852
      root.hoists = context.hoists;
10853
      root.temps = context.temps;
10854
      root.cached = context.cached;
10855
  }
10856
  function createRootCodegen(root, context) {
10857
      const { helper } = context;
10858
      const { children } = root;
10859
      if (children.length === 1) {
10860
          const child = children[0];
10861
          // if the single child is an element, turn it into a block.
10862
          if (isSingleElementRoot(root, child) && child.codegenNode) {
10863
              // single element root is never hoisted so codegenNode will never be
10864
              // SimpleExpressionNode
10865
              const codegenNode = child.codegenNode;
10866
              if (codegenNode.type === 13 /* VNODE_CALL */) {
10867
                  codegenNode.isBlock = true;
10868
                  helper(OPEN_BLOCK);
10869
                  helper(CREATE_BLOCK);
10870
              }
10871
              root.codegenNode = codegenNode;
10872
          }
10873
          else {
10874
              // - single <slot/>, IfNode, ForNode: already blocks.
10875
              // - single text node: always patched.
10876
              // root codegen falls through via genNode()
10877
              root.codegenNode = child;
10878
          }
10879
      }
10880
      else if (children.length > 1) {
10881
          // root has multiple nodes - return a fragment block.
10882
          let patchFlag = 64 /* STABLE_FRAGMENT */;
10883
          let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
10884
          // check if the fragment actually contains a single valid child with
10885
          // the rest being comments
10886
          if (
10887
              children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
10888
              patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
10889
              patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
10890
          }
10891
          root.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root.children, patchFlag + ( ` /* ${patchFlagText} */` ), undefined, undefined, true);
10892
      }
10893
      else ;
10894
  }
10895
  function traverseChildren(parent, context) {
10896
      let i = 0;
10897
      const nodeRemoved = () => {
10898
          i--;
10899
      };
10900
      for (; i < parent.children.length; i++) {
10901
          const child = parent.children[i];
10902
          if (isString(child))
10903
              continue;
10904
          context.parent = parent;
10905
          context.childIndex = i;
10906
          context.onNodeRemoved = nodeRemoved;
10907
          traverseNode(child, context);
10908
      }
10909
  }
10910
  function traverseNode(node, context) {
10911
      context.currentNode = node;
10912
      // apply transform plugins
10913
      const { nodeTransforms } = context;
10914
      const exitFns = [];
10915
      for (let i = 0; i < nodeTransforms.length; i++) {
10916
          const onExit = nodeTransforms[i](node, context);
10917
          if (onExit) {
10918
              if (isArray(onExit)) {
10919
                  exitFns.push(...onExit);
10920
              }
10921
              else {
10922
                  exitFns.push(onExit);
10923
              }
10924
          }
10925
          if (!context.currentNode) {
10926
              // node was removed
10927
              return;
10928
          }
10929
          else {
10930
              // node may have been replaced
10931
              node = context.currentNode;
10932
          }
10933
      }
10934
      switch (node.type) {
10935
          case 3 /* COMMENT */:
10936
              if (!context.ssr) {
10937
                  // inject import for the Comment symbol, which is needed for creating
10938
                  // comment nodes with `createVNode`
10939
                  context.helper(CREATE_COMMENT);
10940
              }
10941
              break;
10942
          case 5 /* INTERPOLATION */:
10943
              // no need to traverse, but we need to inject toString helper
10944
              if (!context.ssr) {
10945
                  context.helper(TO_DISPLAY_STRING);
10946
              }
10947
              break;
10948
          // for container types, further traverse downwards
10949
          case 9 /* IF */:
10950
              for (let i = 0; i < node.branches.length; i++) {
10951
                  traverseNode(node.branches[i], context);
10952
              }
10953
              break;
10954
          case 10 /* IF_BRANCH */:
10955
          case 11 /* FOR */:
10956
          case 1 /* ELEMENT */:
10957
          case 0 /* ROOT */:
10958
              traverseChildren(node, context);
10959
              break;
10960
      }
10961
      // exit transforms
10962
      context.currentNode = node;
10963
      let i = exitFns.length;
10964
      while (i--) {
10965
          exitFns[i]();
10966
      }
10967
  }
10968
  function createStructuralDirectiveTransform(name, fn) {
10969
      const matches = isString(name)
10970
          ? (n) => n === name
10971
          : (n) => name.test(n);
10972
      return (node, context) => {
10973
          if (node.type === 1 /* ELEMENT */) {
10974
              const { props } = node;
10975
              // structural directive transforms are not concerned with slots
10976
              // as they are handled separately in vSlot.ts
10977
              if (node.tagType === 3 /* TEMPLATE */ && props.some(isVSlot)) {
10978
                  return;
10979
              }
10980
              const exitFns = [];
10981
              for (let i = 0; i < props.length; i++) {
10982
                  const prop = props[i];
10983
                  if (prop.type === 7 /* DIRECTIVE */ && matches(prop.name)) {
10984
                      // structural directives are removed to avoid infinite recursion
10985
                      // also we remove them *before* applying so that it can further
10986
                      // traverse itself in case it moves the node around
10987
                      props.splice(i, 1);
10988
                      i--;
10989
                      const onExit = fn(node, prop, context);
10990
                      if (onExit)
10991
                          exitFns.push(onExit);
10992
                  }
10993
              }
10994
              return exitFns;
10995
          }
10996
      };
10997
  }
10998
 
10999
  const PURE_ANNOTATION = `/*#__PURE__*/`;
11000
  function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false }) {
11001
      const context = {
11002
          mode,
11003
          prefixIdentifiers,
11004
          sourceMap,
11005
          filename,
11006
          scopeId,
11007
          optimizeImports,
11008
          runtimeGlobalName,
11009
          runtimeModuleName,
11010
          ssr,
11011
          source: ast.loc.source,
11012
          code: ``,
11013
          column: 1,
11014
          line: 1,
11015
          offset: 0,
11016
          indentLevel: 0,
11017
          pure: false,
11018
          map: undefined,
11019
          helper(key) {
11020
              return `_${helperNameMap[key]}`;
11021
          },
11022
          push(code, node) {
11023
              context.code += code;
11024
          },
11025
          indent() {
11026
              newline(++context.indentLevel);
11027
          },
11028
          deindent(withoutNewLine = false) {
11029
              if (withoutNewLine) {
11030
                  --context.indentLevel;
11031
              }
11032
              else {
11033
                  newline(--context.indentLevel);
11034
              }
11035
          },
11036
          newline() {
11037
              newline(context.indentLevel);
11038
          }
11039
      };
11040
      function newline(n) {
11041
          context.push('\n' + `  `.repeat(n));
11042
      }
11043
      return context;
11044
  }
11045
  function generate(ast, options = {}) {
11046
      const context = createCodegenContext(ast, options);
11047
      if (options.onContextCreated)
11048
          options.onContextCreated(context);
11049
      const { mode, push, prefixIdentifiers, indent, deindent, newline, scopeId, ssr } = context;
11050
      const hasHelpers = ast.helpers.length > 0;
11051
      const useWithBlock = !prefixIdentifiers && mode !== 'module';
11052
      // preambles
11053
      // in setup() inline mode, the preamble is generated in a sub context
11054
      // and returned separately.
11055
      const preambleContext =  context;
11056
      {
11057
          genFunctionPreamble(ast, preambleContext);
11058
      }
11059
      // enter render function
11060
      const functionName = ssr ? `ssrRender` : `render`;
11061
      const args = ssr ? ['_ctx', '_push', '_parent', '_attrs'] : ['_ctx', '_cache'];
11062
      const signature =  args.join(', ');
11063
      {
11064
          push(`function ${functionName}(${signature}) {`);
11065
      }
11066
      indent();
11067
      if (useWithBlock) {
11068
          push(`with (_ctx) {`);
11069
          indent();
11070
          // function mode const declarations should be inside with block
11071
          // also they should be renamed to avoid collision with user properties
11072
          if (hasHelpers) {
11073
              push(`const { ${ast.helpers
11074
                .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
11075
                .join(', ')} } = _Vue`);
11076
              push(`\n`);
11077
              newline();
11078
          }
11079
      }
11080
      // generate asset resolution statements
11081
      if (ast.components.length) {
11082
          genAssets(ast.components, 'component', context);
11083
          if (ast.directives.length || ast.temps > 0) {
11084
              newline();
11085
          }
11086
      }
11087
      if (ast.directives.length) {
11088
          genAssets(ast.directives, 'directive', context);
11089
          if (ast.temps > 0) {
11090
              newline();
11091
          }
11092
      }
11093
      if (ast.temps > 0) {
11094
          push(`let `);
11095
          for (let i = 0; i < ast.temps; i++) {
11096
              push(`${i > 0 ? `, ` : ``}_temp${i}`);
11097
          }
11098
      }
11099
      if (ast.components.length || ast.directives.length || ast.temps) {
11100
          push(`\n`);
11101
          newline();
11102
      }
11103
      // generate the VNode tree expression
11104
      if (!ssr) {
11105
          push(`return `);
11106
      }
11107
      if (ast.codegenNode) {
11108
          genNode(ast.codegenNode, context);
11109
      }
11110
      else {
11111
          push(`null`);
11112
      }
11113
      if (useWithBlock) {
11114
          deindent();
11115
          push(`}`);
11116
      }
11117
      deindent();
11118
      push(`}`);
11119
      return {
11120
          ast,
11121
          code: context.code,
11122
          preamble:  ``,
11123
          // SourceMapGenerator does have toJSON() method but it's not in the types
11124
          map: context.map ? context.map.toJSON() : undefined
11125
      };
11126
  }
11127
  function genFunctionPreamble(ast, context) {
11128
      const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
11129
      const VueBinding =  runtimeGlobalName;
11130
      const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
11131
      // Generate const declaration for helpers
11132
      // In prefix mode, we place the const declaration at top so it's done
11133
      // only once; But if we not prefixing, we place the declaration inside the
11134
      // with block so it doesn't incur the `in` check cost for every helper access.
11135
      if (ast.helpers.length > 0) {
11136
          {
11137
              // "with" mode.
11138
              // save Vue in a separate variable to avoid collision
11139
              push(`const _Vue = ${VueBinding}\n`);
11140
              // in "with" mode, helpers are declared inside the with block to avoid
11141
              // has check cost, but hoists are lifted out of the function - we need
11142
              // to provide the helper here.
11143
              if (ast.hoists.length) {
11144
                  const staticHelpers = [
11145
                      CREATE_VNODE,
11146
                      CREATE_COMMENT,
11147
                      CREATE_TEXT,
11148
                      CREATE_STATIC
11149
                  ]
11150
                      .filter(helper => ast.helpers.includes(helper))
11151
                      .map(aliasHelper)
11152
                      .join(', ');
11153
                  push(`const { ${staticHelpers} } = _Vue\n`);
11154
              }
11155
          }
11156
      }
11157
      genHoists(ast.hoists, context);
11158
      newline();
11159
      push(`return `);
11160
  }
11161
  function genAssets(assets, type, { helper, push, newline }) {
11162
      const resolver = helper(type === 'component' ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE);
11163
      for (let i = 0; i < assets.length; i++) {
11164
          const id = assets[i];
11165
          push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)})`);
11166
          if (i < assets.length - 1) {
11167
              newline();
11168
          }
11169
      }
11170
  }
11171
  function genHoists(hoists, context) {
11172
      if (!hoists.length) {
11173
          return;
11174
      }
11175
      context.pure = true;
11176
      const { push, newline, helper, scopeId, mode } = context;
11177
      newline();
11178
      hoists.forEach((exp, i) => {
11179
          if (exp) {
11180
              push(`const _hoisted_${i + 1} = `);
11181
              genNode(exp, context);
11182
              newline();
11183
          }
11184
      });
11185
      context.pure = false;
11186
  }
11187
  function isText$1(n) {
11188
      return (isString(n) ||
11189
          n.type === 4 /* SIMPLE_EXPRESSION */ ||
11190
          n.type === 2 /* TEXT */ ||
11191
          n.type === 5 /* INTERPOLATION */ ||
11192
          n.type === 8 /* COMPOUND_EXPRESSION */);
11193
  }
11194
  function genNodeListAsArray(nodes, context) {
11195
      const multilines = nodes.length > 3 ||
11196
          ( nodes.some(n => isArray(n) || !isText$1(n)));
11197
      context.push(`[`);
11198
      multilines && context.indent();
11199
      genNodeList(nodes, context, multilines);
11200
      multilines && context.deindent();
11201
      context.push(`]`);
11202
  }
11203
  function genNodeList(nodes, context, multilines = false, comma = true) {
11204
      const { push, newline } = context;
11205
      for (let i = 0; i < nodes.length; i++) {
11206
          const node = nodes[i];
11207
          if (isString(node)) {
11208
              push(node);
11209
          }
11210
          else if (isArray(node)) {
11211
              genNodeListAsArray(node, context);
11212
          }
11213
          else {
11214
              genNode(node, context);
11215
          }
11216
          if (i < nodes.length - 1) {
11217
              if (multilines) {
11218
                  comma && push(',');
11219
                  newline();
11220
              }
11221
              else {
11222
                  comma && push(', ');
11223
              }
11224
          }
11225
      }
11226
  }
11227
  function genNode(node, context) {
11228
      if (isString(node)) {
11229
          context.push(node);
11230
          return;
11231
      }
11232
      if (isSymbol(node)) {
11233
          context.push(context.helper(node));
11234
          return;
11235
      }
11236
      switch (node.type) {
11237
          case 1 /* ELEMENT */:
11238
          case 9 /* IF */:
11239
          case 11 /* FOR */:
11240
 
11241
                  assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
11242
                      `Apply appropriate transforms first.`);
11243
              genNode(node.codegenNode, context);
11244
              break;
11245
          case 2 /* TEXT */:
11246
              genText(node, context);
11247
              break;
11248
          case 4 /* SIMPLE_EXPRESSION */:
11249
              genExpression(node, context);
11250
              break;
11251
          case 5 /* INTERPOLATION */:
11252
              genInterpolation(node, context);
11253
              break;
11254
          case 12 /* TEXT_CALL */:
11255
              genNode(node.codegenNode, context);
11256
              break;
11257
          case 8 /* COMPOUND_EXPRESSION */:
11258
              genCompoundExpression(node, context);
11259
              break;
11260
          case 3 /* COMMENT */:
11261
              genComment(node, context);
11262
              break;
11263
          case 13 /* VNODE_CALL */:
11264
              genVNodeCall(node, context);
11265
              break;
11266
          case 14 /* JS_CALL_EXPRESSION */:
11267
              genCallExpression(node, context);
11268
              break;
11269
          case 15 /* JS_OBJECT_EXPRESSION */:
11270
              genObjectExpression(node, context);
11271
              break;
11272
          case 17 /* JS_ARRAY_EXPRESSION */:
11273
              genArrayExpression(node, context);
11274
              break;
11275
          case 18 /* JS_FUNCTION_EXPRESSION */:
11276
              genFunctionExpression(node, context);
11277
              break;
11278
          case 19 /* JS_CONDITIONAL_EXPRESSION */:
11279
              genConditionalExpression(node, context);
11280
              break;
11281
          case 20 /* JS_CACHE_EXPRESSION */:
11282
              genCacheExpression(node, context);
11283
              break;
11284
          // SSR only types
11285
          case 21 /* JS_BLOCK_STATEMENT */:
11286
              break;
11287
          case 22 /* JS_TEMPLATE_LITERAL */:
11288
              break;
11289
          case 23 /* JS_IF_STATEMENT */:
11290
              break;
11291
          case 24 /* JS_ASSIGNMENT_EXPRESSION */:
11292
              break;
11293
          case 25 /* JS_SEQUENCE_EXPRESSION */:
11294
              break;
11295
          case 26 /* JS_RETURN_STATEMENT */:
11296
              break;
11297
          /* istanbul ignore next */
11298
          case 10 /* IF_BRANCH */:
11299
              // noop
11300
              break;
11301
          default:
11302
              {
11303
                  assert(false, `unhandled codegen node type: ${node.type}`);
11304
                  // make sure we exhaust all possible types
11305
                  const exhaustiveCheck = node;
11306
                  return exhaustiveCheck;
11307
              }
11308
      }
11309
  }
11310
  function genText(node, context) {
11311
      context.push(JSON.stringify(node.content), node);
11312
  }
11313
  function genExpression(node, context) {
11314
      const { content, isStatic } = node;
11315
      context.push(isStatic ? JSON.stringify(content) : content, node);
11316
  }
11317
  function genInterpolation(node, context) {
11318
      const { push, helper, pure } = context;
11319
      if (pure)
11320
          push(PURE_ANNOTATION);
11321
      push(`${helper(TO_DISPLAY_STRING)}(`);
11322
      genNode(node.content, context);
11323
      push(`)`);
11324
  }
11325
  function genCompoundExpression(node, context) {
11326
      for (let i = 0; i < node.children.length; i++) {
11327
          const child = node.children[i];
11328
          if (isString(child)) {
11329
              context.push(child);
11330
          }
11331
          else {
11332
              genNode(child, context);
11333
          }
11334
      }
11335
  }
11336
  function genExpressionAsPropertyKey(node, context) {
11337
      const { push } = context;
11338
      if (node.type === 8 /* COMPOUND_EXPRESSION */) {
11339
          push(`[`);
11340
          genCompoundExpression(node, context);
11341
          push(`]`);
11342
      }
11343
      else if (node.isStatic) {
11344
          // only quote keys if necessary
11345
          const text = isSimpleIdentifier(node.content)
11346
              ? node.content
11347
              : JSON.stringify(node.content);
11348
          push(text, node);
11349
      }
11350
      else {
11351
          push(`[${node.content}]`, node);
11352
      }
11353
  }
11354
  function genComment(node, context) {
11355
      {
11356
          const { push, helper, pure } = context;
11357
          if (pure) {
11358
              push(PURE_ANNOTATION);
11359
          }
11360
          push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
11361
      }
11362
  }
11363
  function genVNodeCall(node, context) {
11364
      const { push, helper, pure } = context;
11365
      const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking } = node;
11366
      if (directives) {
11367
          push(helper(WITH_DIRECTIVES) + `(`);
11368
      }
11369
      if (isBlock) {
11370
          push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
11371
      }
11372
      if (pure) {
11373
          push(PURE_ANNOTATION);
11374
      }
11375
      push(helper(isBlock ? CREATE_BLOCK : CREATE_VNODE) + `(`, node);
11376
      genNodeList(genNullableArgs([tag, props, children, patchFlag, dynamicProps]), context);
11377
      push(`)`);
11378
      if (isBlock) {
11379
          push(`)`);
11380
      }
11381
      if (directives) {
11382
          push(`, `);
11383
          genNode(directives, context);
11384
          push(`)`);
11385
      }
11386
  }
11387
  function genNullableArgs(args) {
11388
      let i = args.length;
11389
      while (i--) {
11390
          if (args[i] != null)
11391
              break;
11392
      }
11393
      return args.slice(0, i + 1).map(arg => arg || `null`);
11394
  }
11395
  // JavaScript
11396
  function genCallExpression(node, context) {
11397
      const { push, helper, pure } = context;
11398
      const callee = isString(node.callee) ? node.callee : helper(node.callee);
11399
      if (pure) {
11400
          push(PURE_ANNOTATION);
11401
      }
11402
      push(callee + `(`, node);
11403
      genNodeList(node.arguments, context);
11404
      push(`)`);
11405
  }
11406
  function genObjectExpression(node, context) {
11407
      const { push, indent, deindent, newline } = context;
11408
      const { properties } = node;
11409
      if (!properties.length) {
11410
          push(`{}`, node);
11411
          return;
11412
      }
11413
      const multilines = properties.length > 1 ||
11414
          (
11415
              properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
11416
      push(multilines ? `{` : `{ `);
11417
      multilines && indent();
11418
      for (let i = 0; i < properties.length; i++) {
11419
          const { key, value } = properties[i];
11420
          // key
11421
          genExpressionAsPropertyKey(key, context);
11422
          push(`: `);
11423
          // value
11424
          genNode(value, context);
11425
          if (i < properties.length - 1) {
11426
              // will only reach this if it's multilines
11427
              push(`,`);
11428
              newline();
11429
          }
11430
      }
11431
      multilines && deindent();
11432
      push(multilines ? `}` : ` }`);
11433
  }
11434
  function genArrayExpression(node, context) {
11435
      genNodeListAsArray(node.elements, context);
11436
  }
11437
  function genFunctionExpression(node, context) {
11438
      const { push, indent, deindent, scopeId, mode } = context;
11439
      const { params, returns, body, newline, isSlot } = node;
11440
      if (isSlot) {
11441
          push(`_${helperNameMap[WITH_CTX]}(`);
11442
      }
11443
      push(`(`, node);
11444
      if (isArray(params)) {
11445
          genNodeList(params, context);
11446
      }
11447
      else if (params) {
11448
          genNode(params, context);
11449
      }
11450
      push(`) => `);
11451
      if (newline || body) {
11452
          push(`{`);
11453
          indent();
11454
      }
11455
      if (returns) {
11456
          if (newline) {
11457
              push(`return `);
11458
          }
11459
          if (isArray(returns)) {
11460
              genNodeListAsArray(returns, context);
11461
          }
11462
          else {
11463
              genNode(returns, context);
11464
          }
11465
      }
11466
      else if (body) {
11467
          genNode(body, context);
11468
      }
11469
      if (newline || body) {
11470
          deindent();
11471
          push(`}`);
11472
      }
11473
      if ( isSlot) {
11474
          push(`)`);
11475
      }
11476
  }
11477
  function genConditionalExpression(node, context) {
11478
      const { test, consequent, alternate, newline: needNewline } = node;
11479
      const { push, indent, deindent, newline } = context;
11480
      if (test.type === 4 /* SIMPLE_EXPRESSION */) {
11481
          const needsParens = !isSimpleIdentifier(test.content);
11482
          needsParens && push(`(`);
11483
          genExpression(test, context);
11484
          needsParens && push(`)`);
11485
      }
11486
      else {
11487
          push(`(`);
11488
          genNode(test, context);
11489
          push(`)`);
11490
      }
11491
      needNewline && indent();
11492
      context.indentLevel++;
11493
      needNewline || push(` `);
11494
      push(`? `);
11495
      genNode(consequent, context);
11496
      context.indentLevel--;
11497
      needNewline && newline();
11498
      needNewline || push(` `);
11499
      push(`: `);
11500
      const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
11501
      if (!isNested) {
11502
          context.indentLevel++;
11503
      }
11504
      genNode(alternate, context);
11505
      if (!isNested) {
11506
          context.indentLevel--;
11507
      }
11508
      needNewline && deindent(true /* without newline */);
11509
  }
11510
  function genCacheExpression(node, context) {
11511
      const { push, helper, indent, deindent, newline } = context;
11512
      push(`_cache[${node.index}] || (`);
11513
      if (node.isVNode) {
11514
          indent();
11515
          push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
11516
          newline();
11517
      }
11518
      push(`_cache[${node.index}] = `);
11519
      genNode(node.value, context);
11520
      if (node.isVNode) {
11521
          push(`,`);
11522
          newline();
11523
          push(`${helper(SET_BLOCK_TRACKING)}(1),`);
11524
          newline();
11525
          push(`_cache[${node.index}]`);
11526
          deindent();
11527
      }
11528
      push(`)`);
11529
  }
11530
 
11531
  // these keywords should not appear inside expressions, but operators like
11532
  // typeof, instanceof and in are allowed
11533
  const prohibitedKeywordRE = new RegExp('\\b' +
11534
      ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
11535
          'super,throw,while,yield,delete,export,import,return,switch,default,' +
11536
          'extends,finally,continue,debugger,function,arguments,typeof,void')
11537
          .split(',')
11538
          .join('\\b|\\b') +
11539
      '\\b');
11540
  // strip strings in expressions
11541
  const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
11542
  /**
11543
   * Validate a non-prefixed expression.
11544
   * This is only called when using the in-browser runtime compiler since it
11545
   * doesn't prefix expressions.
11546
   */
11547
  function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
11548
      const exp = node.content;
11549
      // empty expressions are validated per-directive since some directives
11550
      // do allow empty expressions.
11551
      if (!exp.trim()) {
11552
          return;
11553
      }
11554
      try {
11555
          new Function(asRawStatements
11556
              ? ` ${exp} `
11557
              : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`);
11558
      }
11559
      catch (e) {
11560
          let message = e.message;
11561
          const keywordMatch = exp
11562
              .replace(stripStringRE, '')
11563
              .match(prohibitedKeywordRE);
11564
          if (keywordMatch) {
11565
              message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
11566
          }
11567
          context.onError(createCompilerError(43 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
11568
      }
11569
  }
11570
 
11571
  const transformExpression = (node, context) => {
11572
      if (node.type === 5 /* INTERPOLATION */) {
11573
          node.content = processExpression(node.content, context);
11574
      }
11575
      else if (node.type === 1 /* ELEMENT */) {
11576
          // handle directives on element
11577
          for (let i = 0; i < node.props.length; i++) {
11578
              const dir = node.props[i];
11579
              // do not process for v-on & v-for since they are special handled
11580
              if (dir.type === 7 /* DIRECTIVE */ && dir.name !== 'for') {
11581
                  const exp = dir.exp;
11582
                  const arg = dir.arg;
11583
                  // do not process exp if this is v-on:arg - we need special handling
11584
                  // for wrapping inline statements.
11585
                  if (exp &&
11586
                      exp.type === 4 /* SIMPLE_EXPRESSION */ &&
11587
                      !(dir.name === 'on' && arg)) {
11588
                      dir.exp = processExpression(exp, context,
11589
                      // slot args must be processed as function params
11590
                      dir.name === 'slot');
11591
                  }
11592
                  if (arg && arg.type === 4 /* SIMPLE_EXPRESSION */ && !arg.isStatic) {
11593
                      dir.arg = processExpression(arg, context);
11594
                  }
11595
              }
11596
          }
11597
      }
11598
  };
11599
  // Important: since this function uses Node.js only dependencies, it should
11600
  // always be used with a leading !true check so that it can be
11601
  // tree-shaken from the browser build.
11602
  function processExpression(node, context,
11603
  // some expressions like v-slot props & v-for aliases should be parsed as
11604
  // function params
11605
  asParams = false,
11606
  // v-on handler values may contain multiple statements
11607
  asRawStatements = false) {
11608
      {
11609
          {
11610
              // simple in-browser validation (same logic in 2.x)
11611
              validateBrowserExpression(node, context, asParams, asRawStatements);
11612
          }
11613
          return node;
11614
      }
11615
  }
11616
 
11617
  const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (node, dir, context) => {
11618
      return processIf(node, dir, context, (ifNode, branch, isRoot) => {
11619
          // #1587: We need to dynamically increment the key based on the current
11620
          // node's sibling nodes, since chained v-if/else branches are
11621
          // rendered at the same depth
11622
          const siblings = context.parent.children;
11623
          let i = siblings.indexOf(ifNode);
11624
          let key = 0;
11625
          while (i-- >= 0) {
11626
              const sibling = siblings[i];
11627
              if (sibling && sibling.type === 9 /* IF */) {
11628
                  key += sibling.branches.length;
11629
              }
11630
          }
11631
          // Exit callback. Complete the codegenNode when all children have been
11632
          // transformed.
11633
          return () => {
11634
              if (isRoot) {
11635
                  ifNode.codegenNode = createCodegenNodeForBranch(branch, key, context);
11636
              }
11637
              else {
11638
                  // attach this branch's codegen node to the v-if root.
11639
                  const parentCondition = getParentCondition(ifNode.codegenNode);
11640
                  parentCondition.alternate = createCodegenNodeForBranch(branch, key + ifNode.branches.length - 1, context);
11641
              }
11642
          };
11643
      });
11644
  });
11645
  // target-agnostic transform used for both Client and SSR
11646
  function processIf(node, dir, context, processCodegen) {
11647
      if (dir.name !== 'else' &&
11648
          (!dir.exp || !dir.exp.content.trim())) {
11649
          const loc = dir.exp ? dir.exp.loc : node.loc;
11650
          context.onError(createCompilerError(27 /* X_V_IF_NO_EXPRESSION */, dir.loc));
11651
          dir.exp = createSimpleExpression(`true`, false, loc);
11652
      }
11653
      if ( dir.exp) {
11654
          validateBrowserExpression(dir.exp, context);
11655
      }
11656
      if (dir.name === 'if') {
11657
          const branch = createIfBranch(node, dir);
11658
          const ifNode = {
11659
              type: 9 /* IF */,
11660
              loc: node.loc,
11661
              branches: [branch]
11662
          };
11663
          context.replaceNode(ifNode);
11664
          if (processCodegen) {
11665
              return processCodegen(ifNode, branch, true);
11666
          }
11667
      }
11668
      else {
11669
          // locate the adjacent v-if
11670
          const siblings = context.parent.children;
11671
          const comments = [];
11672
          let i = siblings.indexOf(node);
11673
          while (i-- >= -1) {
11674
              const sibling = siblings[i];
11675
              if ( sibling && sibling.type === 3 /* COMMENT */) {
11676
                  context.removeNode(sibling);
11677
                  comments.unshift(sibling);
11678
                  continue;
11679
              }
11680
              if (sibling &&
11681
                  sibling.type === 2 /* TEXT */ &&
11682
                  !sibling.content.trim().length) {
11683
                  context.removeNode(sibling);
11684
                  continue;
11685
              }
11686
              if (sibling && sibling.type === 9 /* IF */) {
11687
                  // move the node to the if node's branches
11688
                  context.removeNode();
11689
                  const branch = createIfBranch(node, dir);
11690
                  if ( comments.length) {
11691
                      branch.children = [...comments, ...branch.children];
11692
                  }
11693
                  // check if user is forcing same key on different branches
11694
                  {
11695
                      const key = branch.userKey;
11696
                      if (key) {
11697
                          sibling.branches.forEach(({ userKey }) => {
11698
                              if (isSameKey(userKey, key)) {
11699
                                  context.onError(createCompilerError(28 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
11700
                              }
11701
                          });
11702
                      }
11703
                  }
11704
                  sibling.branches.push(branch);
11705
                  const onExit = processCodegen && processCodegen(sibling, branch, false);
11706
                  // since the branch was removed, it will not be traversed.
11707
                  // make sure to traverse here.
11708
                  traverseNode(branch, context);
11709
                  // call on exit
11710
                  if (onExit)
11711
                      onExit();
11712
                  // make sure to reset currentNode after traversal to indicate this
11713
                  // node has been removed.
11714
                  context.currentNode = null;
11715
              }
11716
              else {
11717
                  context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
11718
              }
11719
              break;
11720
          }
11721
      }
11722
  }
11723
  function createIfBranch(node, dir) {
11724
      return {
11725
          type: 10 /* IF_BRANCH */,
11726
          loc: node.loc,
11727
          condition: dir.name === 'else' ? undefined : dir.exp,
11728
          children: node.tagType === 3 /* TEMPLATE */ && !findDir(node, 'for')
11729
              ? node.children
11730
              : [node],
11731
          userKey: findProp(node, `key`)
11732
      };
11733
  }
11734
  function createCodegenNodeForBranch(branch, keyIndex, context) {
11735
      if (branch.condition) {
11736
          return createConditionalExpression(branch.condition, createChildrenCodegenNode(branch, keyIndex, context),
11737
          // make sure to pass in asBlock: true so that the comment node call
11738
          // closes the current block.
11739
          createCallExpression(context.helper(CREATE_COMMENT), [
11740
               '"v-if"' ,
11741
              'true'
11742
          ]));
11743
      }
11744
      else {
11745
          return createChildrenCodegenNode(branch, keyIndex, context);
11746
      }
11747
  }
11748
  function createChildrenCodegenNode(branch, keyIndex, context) {
11749
      const { helper } = context;
11750
      const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* CAN_HOIST */));
11751
      const { children } = branch;
11752
      const firstChild = children[0];
11753
      const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* ELEMENT */;
11754
      if (needFragmentWrapper) {
11755
          if (children.length === 1 && firstChild.type === 11 /* FOR */) {
11756
              // optimize away nested fragments when child is a ForNode
11757
              const vnodeCall = firstChild.codegenNode;
11758
              injectProp(vnodeCall, keyProperty, context);
11759
              return vnodeCall;
11760
          }
11761
          else {
11762
              return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, 64 /* STABLE_FRAGMENT */ +
11763
                  ( ` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
11764
                      ), undefined, undefined, true, false, branch.loc);
11765
          }
11766
      }
11767
      else {
11768
          const vnodeCall = firstChild
11769
              .codegenNode;
11770
          // Change createVNode to createBlock.
11771
          if (vnodeCall.type === 13 /* VNODE_CALL */) {
11772
              vnodeCall.isBlock = true;
11773
              helper(OPEN_BLOCK);
11774
              helper(CREATE_BLOCK);
11775
          }
11776
          // inject branch key
11777
          injectProp(vnodeCall, keyProperty, context);
11778
          return vnodeCall;
11779
      }
11780
  }
11781
  function isSameKey(a, b) {
11782
      if (!a || a.type !== b.type) {
11783
          return false;
11784
      }
11785
      if (a.type === 6 /* ATTRIBUTE */) {
11786
          if (a.value.content !== b.value.content) {
11787
              return false;
11788
          }
11789
      }
11790
      else {
11791
          // directive
11792
          const exp = a.exp;
11793
          const branchExp = b.exp;
11794
          if (exp.type !== branchExp.type) {
11795
              return false;
11796
          }
11797
          if (exp.type !== 4 /* SIMPLE_EXPRESSION */ ||
11798
              (exp.isStatic !== branchExp.isStatic ||
11799
                  exp.content !== branchExp.content)) {
11800
              return false;
11801
          }
11802
      }
11803
      return true;
11804
  }
11805
  function getParentCondition(node) {
11806
      while (true) {
11807
          if (node.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
11808
              if (node.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
11809
                  node = node.alternate;
11810
              }
11811
              else {
11812
                  return node;
11813
              }
11814
          }
11815
          else if (node.type === 20 /* JS_CACHE_EXPRESSION */) {
11816
              node = node.value;
11817
          }
11818
      }
11819
  }
11820
 
11821
  const transformFor = createStructuralDirectiveTransform('for', (node, dir, context) => {
11822
      const { helper } = context;
11823
      return processFor(node, dir, context, forNode => {
11824
          // create the loop render function expression now, and add the
11825
          // iterator on exit after all children have been traversed
11826
          const renderExp = createCallExpression(helper(RENDER_LIST), [
11827
              forNode.source
11828
          ]);
11829
          const keyProp = findProp(node, `key`);
11830
          const keyProperty = keyProp
11831
              ? createObjectProperty(`key`, keyProp.type === 6 /* ATTRIBUTE */
11832
                  ? createSimpleExpression(keyProp.value.content, true)
11833
                  : keyProp.exp)
11834
              : null;
11835
          const isStableFragment = forNode.source.type === 4 /* SIMPLE_EXPRESSION */ &&
11836
              forNode.source.constType > 0;
11837
          const fragmentFlag = isStableFragment
11838
              ? 64 /* STABLE_FRAGMENT */
11839
              : keyProp
11840
                  ? 128 /* KEYED_FRAGMENT */
11841
                  : 256 /* UNKEYED_FRAGMENT */;
11842
          forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, renderExp, fragmentFlag +
11843
              ( ` /* ${PatchFlagNames[fragmentFlag]} */` ), undefined, undefined, true /* isBlock */, !isStableFragment /* disableTracking */, node.loc);
11844
          return () => {
11845
              // finish the codegen now that all children have been traversed
11846
              let childBlock;
11847
              const isTemplate = isTemplateNode(node);
11848
              const { children } = forNode;
11849
              // check <template v-for> key placement
11850
              if ( isTemplate) {
11851
                  node.children.some(c => {
11852
                      if (c.type === 1 /* ELEMENT */) {
11853
                          const key = findProp(c, 'key');
11854
                          if (key) {
11855
                              context.onError(createCompilerError(32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
11856
                              return true;
11857
                          }
11858
                      }
11859
                  });
11860
              }
11861
              const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* ELEMENT */;
11862
              const slotOutlet = isSlotOutlet(node)
11863
                  ? node
11864
                  : isTemplate &&
11865
                      node.children.length === 1 &&
11866
                      isSlotOutlet(node.children[0])
11867
                      ? node.children[0] // api-extractor somehow fails to infer this
11868
                      : null;
11869
              if (slotOutlet) {
11870
                  // <slot v-for="..."> or <template v-for="..."><slot/></template>
11871
                  childBlock = slotOutlet.codegenNode;
11872
                  if (isTemplate && keyProperty) {
11873
                      // <template v-for="..." :key="..."><slot/></template>
11874
                      // we need to inject the key to the renderSlot() call.
11875
                      // the props for renderSlot is passed as the 3rd argument.
11876
                      injectProp(childBlock, keyProperty, context);
11877
                  }
11878
              }
11879
              else if (needFragmentWrapper) {
11880
                  // <template v-for="..."> with text or multi-elements
11881
                  // should generate a fragment block for each loop
11882
                  childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* STABLE_FRAGMENT */ +
11883
                      ( ` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
11884
                          ), undefined, undefined, true);
11885
              }
11886
              else {
11887
                  // Normal element v-for. Directly use the child's codegenNode
11888
                  // but mark it as a block.
11889
                  childBlock = children[0]
11890
                      .codegenNode;
11891
                  if (isTemplate && keyProperty) {
11892
                      injectProp(childBlock, keyProperty, context);
11893
                  }
11894
                  childBlock.isBlock = !isStableFragment;
11895
                  if (childBlock.isBlock) {
11896
                      helper(OPEN_BLOCK);
11897
                      helper(CREATE_BLOCK);
11898
                  }
11899
                  else {
11900
                      helper(CREATE_VNODE);
11901
                  }
11902
              }
11903
              renderExp.arguments.push(createFunctionExpression(createForLoopParams(forNode.parseResult), childBlock, true /* force newline */));
11904
          };
11905
      });
11906
  });
11907
  // target-agnostic transform used for both Client and SSR
11908
  function processFor(node, dir, context, processCodegen) {
11909
      if (!dir.exp) {
11910
          context.onError(createCompilerError(30 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
11911
          return;
11912
      }
11913
      const parseResult = parseForExpression(
11914
      // can only be simple expression because vFor transform is applied
11915
      // before expression transform.
11916
      dir.exp, context);
11917
      if (!parseResult) {
11918
          context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
11919
          return;
11920
      }
11921
      const { addIdentifiers, removeIdentifiers, scopes } = context;
11922
      const { source, value, key, index } = parseResult;
11923
      const forNode = {
11924
          type: 11 /* FOR */,
11925
          loc: dir.loc,
11926
          source,
11927
          valueAlias: value,
11928
          keyAlias: key,
11929
          objectIndexAlias: index,
11930
          parseResult,
11931
          children: isTemplateNode(node) ? node.children : [node]
11932
      };
11933
      context.replaceNode(forNode);
11934
      // bookkeeping
11935
      scopes.vFor++;
11936
      const onExit = processCodegen && processCodegen(forNode);
11937
      return () => {
11938
          scopes.vFor--;
11939
          if (onExit)
11940
              onExit();
11941
      };
11942
  }
11943
  const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
11944
  // This regex doesn't cover the case if key or index aliases have destructuring,
11945
  // but those do not make sense in the first place, so this works in practice.
11946
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
11947
  const stripParensRE = /^\(|\)$/g;
11948
  function parseForExpression(input, context) {
11949
      const loc = input.loc;
11950
      const exp = input.content;
11951
      const inMatch = exp.match(forAliasRE);
11952
      if (!inMatch)
11953
          return;
11954
      const [, LHS, RHS] = inMatch;
11955
      const result = {
11956
          source: createAliasExpression(loc, RHS.trim(), exp.indexOf(RHS, LHS.length)),
11957
          value: undefined,
11958
          key: undefined,
11959
          index: undefined
11960
      };
11961
      {
11962
          validateBrowserExpression(result.source, context);
11963
      }
11964
      let valueContent = LHS.trim()
11965
          .replace(stripParensRE, '')
11966
          .trim();
11967
      const trimmedOffset = LHS.indexOf(valueContent);
11968
      const iteratorMatch = valueContent.match(forIteratorRE);
11969
      if (iteratorMatch) {
11970
          valueContent = valueContent.replace(forIteratorRE, '').trim();
11971
          const keyContent = iteratorMatch[1].trim();
11972
          let keyOffset;
11973
          if (keyContent) {
11974
              keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
11975
              result.key = createAliasExpression(loc, keyContent, keyOffset);
11976
              {
11977
                  validateBrowserExpression(result.key, context, true);
11978
              }
11979
          }
11980
          if (iteratorMatch[2]) {
11981
              const indexContent = iteratorMatch[2].trim();
11982
              if (indexContent) {
11983
                  result.index = createAliasExpression(loc, indexContent, exp.indexOf(indexContent, result.key
11984
                      ? keyOffset + keyContent.length
11985
                      : trimmedOffset + valueContent.length));
11986
                  {
11987
                      validateBrowserExpression(result.index, context, true);
11988
                  }
11989
              }
11990
          }
11991
      }
11992
      if (valueContent) {
11993
          result.value = createAliasExpression(loc, valueContent, trimmedOffset);
11994
          {
11995
              validateBrowserExpression(result.value, context, true);
11996
          }
11997
      }
11998
      return result;
11999
  }
12000
  function createAliasExpression(range, content, offset) {
12001
      return createSimpleExpression(content, false, getInnerRange(range, offset, content.length));
12002
  }
12003
  function createForLoopParams({ value, key, index }) {
12004
      const params = [];
12005
      if (value) {
12006
          params.push(value);
12007
      }
12008
      if (key) {
12009
          if (!value) {
12010
              params.push(createSimpleExpression(`_`, false));
12011
          }
12012
          params.push(key);
12013
      }
12014
      if (index) {
12015
          if (!key) {
12016
              if (!value) {
12017
                  params.push(createSimpleExpression(`_`, false));
12018
              }
12019
              params.push(createSimpleExpression(`__`, false));
12020
          }
12021
          params.push(index);
12022
      }
12023
      return params;
12024
  }
12025
 
12026
  const defaultFallback = createSimpleExpression(`undefined`, false);
12027
  // A NodeTransform that:
12028
  // 1. Tracks scope identifiers for scoped slots so that they don't get prefixed
12029
  //    by transformExpression. This is only applied in non-browser builds with
12030
  //    { prefixIdentifiers: true }.
12031
  // 2. Track v-slot depths so that we know a slot is inside another slot.
12032
  //    Note the exit callback is executed before buildSlots() on the same node,
12033
  //    so only nested slots see positive numbers.
12034
  const trackSlotScopes = (node, context) => {
12035
      if (node.type === 1 /* ELEMENT */ &&
12036
          (node.tagType === 1 /* COMPONENT */ ||
12037
              node.tagType === 3 /* TEMPLATE */)) {
12038
          // We are only checking non-empty v-slot here
12039
          // since we only care about slots that introduce scope variables.
12040
          const vSlot = findDir(node, 'slot');
12041
          if (vSlot) {
12042
              const slotProps = vSlot.exp;
12043
              context.scopes.vSlot++;
12044
              return () => {
12045
                  context.scopes.vSlot--;
12046
              };
12047
          }
12048
      }
12049
  };
12050
  const buildClientSlotFn = (props, children, loc) => createFunctionExpression(props, children, false /* newline */, true /* isSlot */, children.length ? children[0].loc : loc);
12051
  // Instead of being a DirectiveTransform, v-slot processing is called during
12052
  // transformElement to build the slots object for a component.
12053
  function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
12054
      context.helper(WITH_CTX);
12055
      const { children, loc } = node;
12056
      const slotsProperties = [];
12057
      const dynamicSlots = [];
12058
      const buildDefaultSlotProperty = (props, children) => createObjectProperty(`default`, buildSlotFn(props, children, loc));
12059
      // If the slot is inside a v-for or another v-slot, force it to be dynamic
12060
      // since it likely uses a scope variable.
12061
      let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
12062
      // 1. Check for slot with slotProps on component itself.
12063
      //    <Comp v-slot="{ prop }"/>
12064
      const onComponentSlot = findDir(node, 'slot', true);
12065
      if (onComponentSlot) {
12066
          const { arg, exp } = onComponentSlot;
12067
          if (arg && !isStaticExp(arg)) {
12068
              hasDynamicSlots = true;
12069
          }
12070
          slotsProperties.push(createObjectProperty(arg || createSimpleExpression('default', true), buildSlotFn(exp, children, loc)));
12071
      }
12072
      // 2. Iterate through children and check for template slots
12073
      //    <template v-slot:foo="{ prop }">
12074
      let hasTemplateSlots = false;
12075
      let hasNamedDefaultSlot = false;
12076
      const implicitDefaultChildren = [];
12077
      const seenSlotNames = new Set();
12078
      for (let i = 0; i < children.length; i++) {
12079
          const slotElement = children[i];
12080
          let slotDir;
12081
          if (!isTemplateNode(slotElement) ||
12082
              !(slotDir = findDir(slotElement, 'slot', true))) {
12083
              // not a <template v-slot>, skip.
12084
              if (slotElement.type !== 3 /* COMMENT */) {
12085
                  implicitDefaultChildren.push(slotElement);
12086
              }
12087
              continue;
12088
          }
12089
          if (onComponentSlot) {
12090
              // already has on-component slot - this is incorrect usage.
12091
              context.onError(createCompilerError(36 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
12092
              break;
12093
          }
12094
          hasTemplateSlots = true;
12095
          const { children: slotChildren, loc: slotLoc } = slotElement;
12096
          const { arg: slotName = createSimpleExpression(`default`, true), exp: slotProps, loc: dirLoc } = slotDir;
12097
          // check if name is dynamic.
12098
          let staticSlotName;
12099
          if (isStaticExp(slotName)) {
12100
              staticSlotName = slotName ? slotName.content : `default`;
12101
          }
12102
          else {
12103
              hasDynamicSlots = true;
12104
          }
12105
          const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
12106
          // check if this slot is conditional (v-if/v-for)
12107
          let vIf;
12108
          let vElse;
12109
          let vFor;
12110
          if ((vIf = findDir(slotElement, 'if'))) {
12111
              hasDynamicSlots = true;
12112
              dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback));
12113
          }
12114
          else if ((vElse = findDir(slotElement, /^else(-if)?$/, true /* allowEmpty */))) {
12115
              // find adjacent v-if
12116
              let j = i;
12117
              let prev;
12118
              while (j--) {
12119
                  prev = children[j];
12120
                  if (prev.type !== 3 /* COMMENT */) {
12121
                      break;
12122
                  }
12123
              }
12124
              if (prev && isTemplateNode(prev) && findDir(prev, 'if')) {
12125
                  // remove node
12126
                  children.splice(i, 1);
12127
                  i--;
12128
                  // attach this slot to previous conditional
12129
                  let conditional = dynamicSlots[dynamicSlots.length - 1];
12130
                  while (conditional.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
12131
                      conditional = conditional.alternate;
12132
                  }
12133
                  conditional.alternate = vElse.exp
12134
                      ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback)
12135
                      : buildDynamicSlot(slotName, slotFunction);
12136
              }
12137
              else {
12138
                  context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
12139
              }
12140
          }
12141
          else if ((vFor = findDir(slotElement, 'for'))) {
12142
              hasDynamicSlots = true;
12143
              const parseResult = vFor.parseResult ||
12144
                  parseForExpression(vFor.exp, context);
12145
              if (parseResult) {
12146
                  // Render the dynamic slots as an array and add it to the createSlot()
12147
                  // args. The runtime knows how to handle it appropriately.
12148
                  dynamicSlots.push(createCallExpression(context.helper(RENDER_LIST), [
12149
                      parseResult.source,
12150
                      createFunctionExpression(createForLoopParams(parseResult), buildDynamicSlot(slotName, slotFunction), true /* force newline */)
12151
                  ]));
12152
              }
12153
              else {
12154
                  context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
12155
              }
12156
          }
12157
          else {
12158
              // check duplicate static names
12159
              if (staticSlotName) {
12160
                  if (seenSlotNames.has(staticSlotName)) {
12161
                      context.onError(createCompilerError(37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
12162
                      continue;
12163
                  }
12164
                  seenSlotNames.add(staticSlotName);
12165
                  if (staticSlotName === 'default') {
12166
                      hasNamedDefaultSlot = true;
12167
                  }
12168
              }
12169
              slotsProperties.push(createObjectProperty(slotName, slotFunction));
12170
          }
12171
      }
12172
      if (!onComponentSlot) {
12173
          if (!hasTemplateSlots) {
12174
              // implicit default slot (on component)
12175
              slotsProperties.push(buildDefaultSlotProperty(undefined, children));
12176
          }
12177
          else if (implicitDefaultChildren.length) {
12178
              // implicit default slot (mixed with named slots)
12179
              if (hasNamedDefaultSlot) {
12180
                  context.onError(createCompilerError(38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
12181
              }
12182
              else {
12183
                  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
12184
              }
12185
          }
12186
      }
12187
      const slotFlag = hasDynamicSlots
12188
          ? 2 /* DYNAMIC */
12189
          : hasForwardedSlots(node.children)
12190
              ? 3 /* FORWARDED */
12191
              : 1 /* STABLE */;
12192
      let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`,
12193
      // 2 = compiled but dynamic = can skip normalization, but must run diff
12194
      // 1 = compiled and static = can skip normalization AND diff as optimized
12195
      createSimpleExpression(slotFlag + ( ` /* ${slotFlagsText[slotFlag]} */` ), false))), loc);
12196
      if (dynamicSlots.length) {
12197
          slots = createCallExpression(context.helper(CREATE_SLOTS), [
12198
              slots,
12199
              createArrayExpression(dynamicSlots)
12200
          ]);
12201
      }
12202
      return {
12203
          slots,
12204
          hasDynamicSlots
12205
      };
12206
  }
12207
  function buildDynamicSlot(name, fn) {
12208
      return createObjectExpression([
12209
          createObjectProperty(`name`, name),
12210
          createObjectProperty(`fn`, fn)
12211
      ]);
12212
  }
12213
  function hasForwardedSlots(children) {
12214
      for (let i = 0; i < children.length; i++) {
12215
          const child = children[i];
12216
          if (child.type === 1 /* ELEMENT */) {
12217
              if (child.tagType === 2 /* SLOT */ ||
12218
                  (child.tagType === 0 /* ELEMENT */ &&
12219
                      hasForwardedSlots(child.children))) {
12220
                  return true;
12221
              }
12222
          }
12223
      }
12224
      return false;
12225
  }
12226
 
12227
  // some directive transforms (e.g. v-model) may return a symbol for runtime
12228
  // import, which should be used instead of a resolveDirective call.
12229
  const directiveImportMap = new WeakMap();
12230
  // generate a JavaScript AST for this element's codegen
12231
  const transformElement = (node, context) => {
12232
      if (!(node.type === 1 /* ELEMENT */ &&
12233
          (node.tagType === 0 /* ELEMENT */ ||
12234
              node.tagType === 1 /* COMPONENT */))) {
12235
          return;
12236
      }
12237
      // perform the work on exit, after all child expressions have been
12238
      // processed and merged.
12239
      return function postTransformElement() {
12240
          const { tag, props } = node;
12241
          const isComponent = node.tagType === 1 /* COMPONENT */;
12242
          // The goal of the transform is to create a codegenNode implementing the
12243
          // VNodeCall interface.
12244
          const vnodeTag = isComponent
12245
              ? resolveComponentType(node, context)
12246
              : `"${tag}"`;
12247
          const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
12248
          let vnodeProps;
12249
          let vnodeChildren;
12250
          let vnodePatchFlag;
12251
          let patchFlag = 0;
12252
          let vnodeDynamicProps;
12253
          let dynamicPropNames;
12254
          let vnodeDirectives;
12255
          let shouldUseBlock =
12256
          // dynamic component may resolve to plain elements
12257
          isDynamicComponent ||
12258
              vnodeTag === TELEPORT ||
12259
              vnodeTag === SUSPENSE ||
12260
              (!isComponent &&
12261
                  // <svg> and <foreignObject> must be forced into blocks so that block
12262
                  // updates inside get proper isSVG flag at runtime. (#639, #643)
12263
                  // This is technically web-specific, but splitting the logic out of core
12264
                  // leads to too much unnecessary complexity.
12265
                  (tag === 'svg' ||
12266
                      tag === 'foreignObject' ||
12267
                      // #938: elements with dynamic keys should be forced into blocks
12268
                      findProp(node, 'key', true)));
12269
          // props
12270
          if (props.length > 0) {
12271
              const propsBuildResult = buildProps(node, context);
12272
              vnodeProps = propsBuildResult.props;
12273
              patchFlag = propsBuildResult.patchFlag;
12274
              dynamicPropNames = propsBuildResult.dynamicPropNames;
12275
              const directives = propsBuildResult.directives;
12276
              vnodeDirectives =
12277
                  directives && directives.length
12278
                      ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
12279
                      : undefined;
12280
          }
12281
          // children
12282
          if (node.children.length > 0) {
12283
              if (vnodeTag === KEEP_ALIVE) {
12284
                  // Although a built-in component, we compile KeepAlive with raw children
12285
                  // instead of slot functions so that it can be used inside Transition
12286
                  // or other Transition-wrapping HOCs.
12287
                  // To ensure correct updates with block optimizations, we need to:
12288
                  // 1. Force keep-alive into a block. This avoids its children being
12289
                  //    collected by a parent block.
12290
                  shouldUseBlock = true;
12291
                  // 2. Force keep-alive to always be updated, since it uses raw children.
12292
                  patchFlag |= 1024 /* DYNAMIC_SLOTS */;
12293
                  if ( node.children.length > 1) {
12294
                      context.onError(createCompilerError(44 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
12295
                          start: node.children[0].loc.start,
12296
                          end: node.children[node.children.length - 1].loc.end,
12297
                          source: ''
12298
                      }));
12299
                  }
12300
              }
12301
              const shouldBuildAsSlots = isComponent &&
12302
                  // Teleport is not a real component and has dedicated runtime handling
12303
                  vnodeTag !== TELEPORT &&
12304
                  // explained above.
12305
                  vnodeTag !== KEEP_ALIVE;
12306
              if (shouldBuildAsSlots) {
12307
                  const { slots, hasDynamicSlots } = buildSlots(node, context);
12308
                  vnodeChildren = slots;
12309
                  if (hasDynamicSlots) {
12310
                      patchFlag |= 1024 /* DYNAMIC_SLOTS */;
12311
                  }
12312
              }
12313
              else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
12314
                  const child = node.children[0];
12315
                  const type = child.type;
12316
                  // check for dynamic text children
12317
                  const hasDynamicTextChild = type === 5 /* INTERPOLATION */ ||
12318
                      type === 8 /* COMPOUND_EXPRESSION */;
12319
                  if (hasDynamicTextChild &&
12320
                      getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
12321
                      patchFlag |= 1 /* TEXT */;
12322
                  }
12323
                  // pass directly if the only child is a text node
12324
                  // (plain / interpolation / expression)
12325
                  if (hasDynamicTextChild || type === 2 /* TEXT */) {
12326
                      vnodeChildren = child;
12327
                  }
12328
                  else {
12329
                      vnodeChildren = node.children;
12330
                  }
12331
              }
12332
              else {
12333
                  vnodeChildren = node.children;
12334
              }
12335
          }
12336
          // patchFlag & dynamicPropNames
12337
          if (patchFlag !== 0) {
12338
              {
12339
                  if (patchFlag < 0) {
12340
                      // special flags (negative and mutually exclusive)
12341
                      vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
12342
                  }
12343
                  else {
12344
                      // bitwise flags
12345
                      const flagNames = Object.keys(PatchFlagNames)
12346
                          .map(Number)
12347
                          .filter(n => n > 0 && patchFlag & n)
12348
                          .map(n => PatchFlagNames[n])
12349
                          .join(`, `);
12350
                      vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
12351
                  }
12352
              }
12353
              if (dynamicPropNames && dynamicPropNames.length) {
12354
                  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
12355
              }
12356
          }
12357
          node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, vnodePatchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false /* disableTracking */, node.loc);
12358
      };
12359
  };
12360
  function resolveComponentType(node, context, ssr = false) {
12361
      const { tag } = node;
12362
      // 1. dynamic component
12363
      const isProp = node.tag === 'component' ? findProp(node, 'is') : findDir(node, 'is');
12364
      if (isProp) {
12365
          const exp = isProp.type === 6 /* ATTRIBUTE */
12366
              ? isProp.value && createSimpleExpression(isProp.value.content, true)
12367
              : isProp.exp;
12368
          if (exp) {
12369
              return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
12370
                  exp
12371
              ]);
12372
          }
12373
      }
12374
      // 2. built-in components (Teleport, Transition, KeepAlive, Suspense...)
12375
      const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
12376
      if (builtIn) {
12377
          // built-ins are simply fallthroughs / have special handling during ssr
12378
          // so we don't need to import their runtime equivalents
12379
          if (!ssr)
12380
              context.helper(builtIn);
12381
          return builtIn;
12382
      }
12383
      // 5. user component (resolve)
12384
      context.helper(RESOLVE_COMPONENT);
12385
      context.components.add(tag);
12386
      return toValidAssetId(tag, `component`);
12387
  }
12388
  function buildProps(node, context, props = node.props, ssr = false) {
12389
      const { tag, loc: elementLoc } = node;
12390
      const isComponent = node.tagType === 1 /* COMPONENT */;
12391
      let properties = [];
12392
      const mergeArgs = [];
12393
      const runtimeDirectives = [];
12394
      // patchFlag analysis
12395
      let patchFlag = 0;
12396
      let hasRef = false;
12397
      let hasClassBinding = false;
12398
      let hasStyleBinding = false;
12399
      let hasHydrationEventBinding = false;
12400
      let hasDynamicKeys = false;
12401
      let hasVnodeHook = false;
12402
      const dynamicPropNames = [];
12403
      const analyzePatchFlag = ({ key, value }) => {
12404
          if (isStaticExp(key)) {
12405
              const name = key.content;
12406
              const isEventHandler = isOn(name);
12407
              if (!isComponent &&
12408
                  isEventHandler &&
12409
                  // omit the flag for click handlers because hydration gives click
12410
                  // dedicated fast path.
12411
                  name.toLowerCase() !== 'onclick' &&
12412
                  // omit v-model handlers
12413
                  name !== 'onUpdate:modelValue' &&
12414
                  // omit onVnodeXXX hooks
12415
                  !isReservedProp(name)) {
12416
                  hasHydrationEventBinding = true;
12417
              }
12418
              if (isEventHandler && isReservedProp(name)) {
12419
                  hasVnodeHook = true;
12420
              }
12421
              if (value.type === 20 /* JS_CACHE_EXPRESSION */ ||
12422
                  ((value.type === 4 /* SIMPLE_EXPRESSION */ ||
12423
                      value.type === 8 /* COMPOUND_EXPRESSION */) &&
12424
                      getConstantType(value, context) > 0)) {
12425
                  // skip if the prop is a cached handler or has constant value
12426
                  return;
12427
              }
12428
              if (name === 'ref') {
12429
                  hasRef = true;
12430
              }
12431
              else if (name === 'class' && !isComponent) {
12432
                  hasClassBinding = true;
12433
              }
12434
              else if (name === 'style' && !isComponent) {
12435
                  hasStyleBinding = true;
12436
              }
12437
              else if (name !== 'key' && !dynamicPropNames.includes(name)) {
12438
                  dynamicPropNames.push(name);
12439
              }
12440
          }
12441
          else {
12442
              hasDynamicKeys = true;
12443
          }
12444
      };
12445
      for (let i = 0; i < props.length; i++) {
12446
          // static attribute
12447
          const prop = props[i];
12448
          if (prop.type === 6 /* ATTRIBUTE */) {
12449
              const { loc, name, value } = prop;
12450
              let isStatic = true;
12451
              if (name === 'ref') {
12452
                  hasRef = true;
12453
              }
12454
              // skip :is on <component>
12455
              if (name === 'is' && tag === 'component') {
12456
                  continue;
12457
              }
12458
              properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
12459
          }
12460
          else {
12461
              // directives
12462
              const { name, arg, exp, loc } = prop;
12463
              const isBind = name === 'bind';
12464
              const isOn = name === 'on';
12465
              // skip v-slot - it is handled by its dedicated transform.
12466
              if (name === 'slot') {
12467
                  if (!isComponent) {
12468
                      context.onError(createCompilerError(39 /* X_V_SLOT_MISPLACED */, loc));
12469
                  }
12470
                  continue;
12471
              }
12472
              // skip v-once - it is handled by its dedicated transform.
12473
              if (name === 'once') {
12474
                  continue;
12475
              }
12476
              // skip v-is and :is on <component>
12477
              if (name === 'is' ||
12478
                  (isBind && tag === 'component' && isBindKey(arg, 'is'))) {
12479
                  continue;
12480
              }
12481
              // skip v-on in SSR compilation
12482
              if (isOn && ssr) {
12483
                  continue;
12484
              }
12485
              // special case for v-bind and v-on with no argument
12486
              if (!arg && (isBind || isOn)) {
12487
                  hasDynamicKeys = true;
12488
                  if (exp) {
12489
                      if (properties.length) {
12490
                          mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
12491
                          properties = [];
12492
                      }
12493
                      if (isBind) {
12494
                          mergeArgs.push(exp);
12495
                      }
12496
                      else {
12497
                          // v-on="obj" -> toHandlers(obj)
12498
                          mergeArgs.push({
12499
                              type: 14 /* JS_CALL_EXPRESSION */,
12500
                              loc,
12501
                              callee: context.helper(TO_HANDLERS),
12502
                              arguments: [exp]
12503
                          });
12504
                      }
12505
                  }
12506
                  else {
12507
                      context.onError(createCompilerError(isBind
12508
                          ? 33 /* X_V_BIND_NO_EXPRESSION */
12509
                          : 34 /* X_V_ON_NO_EXPRESSION */, loc));
12510
                  }
12511
                  continue;
12512
              }
12513
              const directiveTransform = context.directiveTransforms[name];
12514
              if (directiveTransform) {
12515
                  // has built-in directive transform.
12516
                  const { props, needRuntime } = directiveTransform(prop, node, context);
12517
                  !ssr && props.forEach(analyzePatchFlag);
12518
                  properties.push(...props);
12519
                  if (needRuntime) {
12520
                      runtimeDirectives.push(prop);
12521
                      if (isSymbol(needRuntime)) {
12522
                          directiveImportMap.set(prop, needRuntime);
12523
                      }
12524
                  }
12525
              }
12526
              else {
12527
                  // no built-in transform, this is a user custom directive.
12528
                  runtimeDirectives.push(prop);
12529
              }
12530
          }
12531
      }
12532
      let propsExpression = undefined;
12533
      // has v-bind="object" or v-on="object", wrap with mergeProps
12534
      if (mergeArgs.length) {
12535
          if (properties.length) {
12536
              mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
12537
          }
12538
          if (mergeArgs.length > 1) {
12539
              propsExpression = createCallExpression(context.helper(MERGE_PROPS), mergeArgs, elementLoc);
12540
          }
12541
          else {
12542
              // single v-bind with nothing else - no need for a mergeProps call
12543
              propsExpression = mergeArgs[0];
12544
          }
12545
      }
12546
      else if (properties.length) {
12547
          propsExpression = createObjectExpression(dedupeProperties(properties), elementLoc);
12548
      }
12549
      // patchFlag analysis
12550
      if (hasDynamicKeys) {
12551
          patchFlag |= 16 /* FULL_PROPS */;
12552
      }
12553
      else {
12554
          if (hasClassBinding) {
12555
              patchFlag |= 2 /* CLASS */;
12556
          }
12557
          if (hasStyleBinding) {
12558
              patchFlag |= 4 /* STYLE */;
12559
          }
12560
          if (dynamicPropNames.length) {
12561
              patchFlag |= 8 /* PROPS */;
12562
          }
12563
          if (hasHydrationEventBinding) {
12564
              patchFlag |= 32 /* HYDRATE_EVENTS */;
12565
          }
12566
      }
12567
      if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
12568
          (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
12569
          patchFlag |= 512 /* NEED_PATCH */;
12570
      }
12571
      return {
12572
          props: propsExpression,
12573
          directives: runtimeDirectives,
12574
          patchFlag,
12575
          dynamicPropNames
12576
      };
12577
  }
12578
  // Dedupe props in an object literal.
12579
  // Literal duplicated attributes would have been warned during the parse phase,
12580
  // however, it's possible to encounter duplicated `onXXX` handlers with different
12581
  // modifiers. We also need to merge static and dynamic class / style attributes.
12582
  // - onXXX handlers / style: merge into array
12583
  // - class: merge into single expression with concatenation
12584
  function dedupeProperties(properties) {
12585
      const knownProps = new Map();
12586
      const deduped = [];
12587
      for (let i = 0; i < properties.length; i++) {
12588
          const prop = properties[i];
12589
          // dynamic keys are always allowed
12590
          if (prop.key.type === 8 /* COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
12591
              deduped.push(prop);
12592
              continue;
12593
          }
12594
          const name = prop.key.content;
12595
          const existing = knownProps.get(name);
12596
          if (existing) {
12597
              if (name === 'style' || name === 'class' || name.startsWith('on')) {
12598
                  mergeAsArray(existing, prop);
12599
              }
12600
              // unexpected duplicate, should have emitted error during parse
12601
          }
12602
          else {
12603
              knownProps.set(name, prop);
12604
              deduped.push(prop);
12605
          }
12606
      }
12607
      return deduped;
12608
  }
12609
  function mergeAsArray(existing, incoming) {
12610
      if (existing.value.type === 17 /* JS_ARRAY_EXPRESSION */) {
12611
          existing.value.elements.push(incoming.value);
12612
      }
12613
      else {
12614
          existing.value = createArrayExpression([existing.value, incoming.value], existing.loc);
12615
      }
12616
  }
12617
  function buildDirectiveArgs(dir, context) {
12618
      const dirArgs = [];
12619
      const runtime = directiveImportMap.get(dir);
12620
      if (runtime) {
12621
          // built-in directive with runtime
12622
          dirArgs.push(context.helperString(runtime));
12623
      }
12624
      else {
12625
          {
12626
              // inject statement for resolving directive
12627
              context.helper(RESOLVE_DIRECTIVE);
12628
              context.directives.add(dir.name);
12629
              dirArgs.push(toValidAssetId(dir.name, `directive`));
12630
          }
12631
      }
12632
      const { loc } = dir;
12633
      if (dir.exp)
12634
          dirArgs.push(dir.exp);
12635
      if (dir.arg) {
12636
          if (!dir.exp) {
12637
              dirArgs.push(`void 0`);
12638
          }
12639
          dirArgs.push(dir.arg);
12640
      }
12641
      if (Object.keys(dir.modifiers).length) {
12642
          if (!dir.arg) {
12643
              if (!dir.exp) {
12644
                  dirArgs.push(`void 0`);
12645
              }
12646
              dirArgs.push(`void 0`);
12647
          }
12648
          const trueExpression = createSimpleExpression(`true`, false, loc);
12649
          dirArgs.push(createObjectExpression(dir.modifiers.map(modifier => createObjectProperty(modifier, trueExpression)), loc));
12650
      }
12651
      return createArrayExpression(dirArgs, dir.loc);
12652
  }
12653
  function stringifyDynamicPropNames(props) {
12654
      let propsNamesString = `[`;
12655
      for (let i = 0, l = props.length; i < l; i++) {
12656
          propsNamesString += JSON.stringify(props[i]);
12657
          if (i < l - 1)
12658
              propsNamesString += ', ';
12659
      }
12660
      return propsNamesString + `]`;
12661
  }
12662
 
12663
  const transformSlotOutlet = (node, context) => {
12664
      if (isSlotOutlet(node)) {
12665
          const { children, loc } = node;
12666
          const { slotName, slotProps } = processSlotOutlet(node, context);
12667
          const slotArgs = [
12668
              context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
12669
              slotName
12670
          ];
12671
          if (slotProps) {
12672
              slotArgs.push(slotProps);
12673
          }
12674
          if (children.length) {
12675
              if (!slotProps) {
12676
                  slotArgs.push(`{}`);
12677
              }
12678
              slotArgs.push(createFunctionExpression([], children, false, false, loc));
12679
          }
12680
          node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
12681
      }
12682
  };
12683
  function processSlotOutlet(node, context) {
12684
      let slotName = `"default"`;
12685
      let slotProps = undefined;
12686
      const nonNameProps = [];
12687
      for (let i = 0; i < node.props.length; i++) {
12688
          const p = node.props[i];
12689
          if (p.type === 6 /* ATTRIBUTE */) {
12690
              if (p.value) {
12691
                  if (p.name === 'name') {
12692
                      slotName = JSON.stringify(p.value.content);
12693
                  }
12694
                  else {
12695
                      p.name = camelize(p.name);
12696
                      nonNameProps.push(p);
12697
                  }
12698
              }
12699
          }
12700
          else {
12701
              if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
12702
                  if (p.exp)
12703
                      slotName = p.exp;
12704
              }
12705
              else {
12706
                  if (p.name === 'bind' && p.arg && isStaticExp(p.arg)) {
12707
                      p.arg.content = camelize(p.arg.content);
12708
                  }
12709
                  nonNameProps.push(p);
12710
              }
12711
          }
12712
      }
12713
      if (nonNameProps.length > 0) {
12714
          const { props, directives } = buildProps(node, context, nonNameProps);
12715
          slotProps = props;
12716
          if (directives.length) {
12717
              context.onError(createCompilerError(35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
12718
          }
12719
      }
12720
      return {
12721
          slotName,
12722
          slotProps
12723
      };
12724
  }
12725
 
12726
  const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
12727
  const transformOn = (dir, node, context, augmentor) => {
12728
      const { loc, modifiers, arg } = dir;
12729
      if (!dir.exp && !modifiers.length) {
12730
          context.onError(createCompilerError(34 /* X_V_ON_NO_EXPRESSION */, loc));
12731
      }
12732
      let eventName;
12733
      if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
12734
          if (arg.isStatic) {
12735
              const rawName = arg.content;
12736
              // for all event listeners, auto convert it to camelCase. See issue #2249
12737
              eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
12738
          }
12739
          else {
12740
              // #2388
12741
              eventName = createCompoundExpression([
12742
                  `${context.helperString(TO_HANDLER_KEY)}(`,
12743
                  arg,
12744
                  `)`
12745
              ]);
12746
          }
12747
      }
12748
      else {
12749
          // already a compound expression.
12750
          eventName = arg;
12751
          eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
12752
          eventName.children.push(`)`);
12753
      }
12754
      // handler processing
12755
      let exp = dir.exp;
12756
      if (exp && !exp.content.trim()) {
12757
          exp = undefined;
12758
      }
12759
      let shouldCache = context.cacheHandlers && !exp;
12760
      if (exp) {
12761
          const isMemberExp = isMemberExpression(exp.content);
12762
          const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
12763
          const hasMultipleStatements = exp.content.includes(`;`);
12764
          {
12765
              validateBrowserExpression(exp, context, false, hasMultipleStatements);
12766
          }
12767
          if (isInlineStatement || (shouldCache && isMemberExp)) {
12768
              // wrap inline statement in a function expression
12769
              exp = createCompoundExpression([
12770
                  `${isInlineStatement
12771
                    ?  `$event`
12772
                    : `${ ``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
12773
                  exp,
12774
                  hasMultipleStatements ? `}` : `)`
12775
              ]);
12776
          }
12777
      }
12778
      let ret = {
12779
          props: [
12780
              createObjectProperty(eventName, exp || createSimpleExpression(`() => {}`, false, loc))
12781
          ]
12782
      };
12783
      // apply extended compiler augmentor
12784
      if (augmentor) {
12785
          ret = augmentor(ret);
12786
      }
12787
      if (shouldCache) {
12788
          // cache handlers so that it's always the same handler being passed down.
12789
          // this avoids unnecessary re-renders when users use inline handlers on
12790
          // components.
12791
          ret.props[0].value = context.cache(ret.props[0].value);
12792
      }
12793
      return ret;
12794
  };
12795
 
12796
  // v-bind without arg is handled directly in ./transformElements.ts due to it affecting
12797
  // codegen for the entire props object. This transform here is only for v-bind
12798
  // *with* args.
12799
  const transformBind = (dir, node, context) => {
12800
      const { exp, modifiers, loc } = dir;
12801
      const arg = dir.arg;
12802
      if (arg.type !== 4 /* SIMPLE_EXPRESSION */) {
12803
          arg.children.unshift(`(`);
12804
          arg.children.push(`) || ""`);
12805
      }
12806
      else if (!arg.isStatic) {
12807
          arg.content = `${arg.content} || ""`;
12808
      }
12809
      // .prop is no longer necessary due to new patch behavior
12810
      // .sync is replaced by v-model:arg
12811
      if (modifiers.includes('camel')) {
12812
          if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
12813
              if (arg.isStatic) {
12814
                  arg.content = camelize(arg.content);
12815
              }
12816
              else {
12817
                  arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
12818
              }
12819
          }
12820
          else {
12821
              arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
12822
              arg.children.push(`)`);
12823
          }
12824
      }
12825
      if (!exp ||
12826
          (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
12827
          context.onError(createCompilerError(33 /* X_V_BIND_NO_EXPRESSION */, loc));
12828
          return {
12829
              props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
12830
          };
12831
      }
12832
      return {
12833
          props: [createObjectProperty(arg, exp)]
12834
      };
12835
  };
12836
 
12837
  // Merge adjacent text nodes and expressions into a single expression
12838
  // e.g. <div>abc {{ d }} {{ e }}</div> should have a single expression node as child.
12839
  const transformText = (node, context) => {
12840
      if (node.type === 0 /* ROOT */ ||
12841
          node.type === 1 /* ELEMENT */ ||
12842
          node.type === 11 /* FOR */ ||
12843
          node.type === 10 /* IF_BRANCH */) {
12844
          // perform the transform on node exit so that all expressions have already
12845
          // been processed.
12846
          return () => {
12847
              const children = node.children;
12848
              let currentContainer = undefined;
12849
              let hasText = false;
12850
              for (let i = 0; i < children.length; i++) {
12851
                  const child = children[i];
12852
                  if (isText(child)) {
12853
                      hasText = true;
12854
                      for (let j = i + 1; j < children.length; j++) {
12855
                          const next = children[j];
12856
                          if (isText(next)) {
12857
                              if (!currentContainer) {
12858
                                  currentContainer = children[i] = {
12859
                                      type: 8 /* COMPOUND_EXPRESSION */,
12860
                                      loc: child.loc,
12861
                                      children: [child]
12862
                                  };
12863
                              }
12864
                              // merge adjacent text node into current
12865
                              currentContainer.children.push(` + `, next);
12866
                              children.splice(j, 1);
12867
                              j--;
12868
                          }
12869
                          else {
12870
                              currentContainer = undefined;
12871
                              break;
12872
                          }
12873
                      }
12874
                  }
12875
              }
12876
              if (!hasText ||
12877
                  // if this is a plain element with a single text child, leave it
12878
                  // as-is since the runtime has dedicated fast path for this by directly
12879
                  // setting textContent of the element.
12880
                  // for component root it's always normalized anyway.
12881
                  (children.length === 1 &&
12882
                      (node.type === 0 /* ROOT */ ||
12883
                          (node.type === 1 /* ELEMENT */ &&
12884
                              node.tagType === 0 /* ELEMENT */)))) {
12885
                  return;
12886
              }
12887
              // pre-convert text nodes into createTextVNode(text) calls to avoid
12888
              // runtime normalization.
12889
              for (let i = 0; i < children.length; i++) {
12890
                  const child = children[i];
12891
                  if (isText(child) || child.type === 8 /* COMPOUND_EXPRESSION */) {
12892
                      const callArgs = [];
12893
                      // createTextVNode defaults to single whitespace, so if it is a
12894
                      // single space the code could be an empty call to save bytes.
12895
                      if (child.type !== 2 /* TEXT */ || child.content !== ' ') {
12896
                          callArgs.push(child);
12897
                      }
12898
                      // mark dynamic text with flag so it gets patched inside a block
12899
                      if (!context.ssr &&
12900
                          getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
12901
                          callArgs.push(1 /* TEXT */ +
12902
                              ( ` /* ${PatchFlagNames[1 /* TEXT */]} */` ));
12903
                      }
12904
                      children[i] = {
12905
                          type: 12 /* TEXT_CALL */,
12906
                          content: child,
12907
                          loc: child.loc,
12908
                          codegenNode: createCallExpression(context.helper(CREATE_TEXT), callArgs)
12909
                      };
12910
                  }
12911
              }
12912
          };
12913
      }
12914
  };
12915
 
12916
  const seen = new WeakSet();
12917
  const transformOnce = (node, context) => {
12918
      if (node.type === 1 /* ELEMENT */ && findDir(node, 'once', true)) {
12919
          if (seen.has(node)) {
12920
              return;
12921
          }
12922
          seen.add(node);
12923
          context.helper(SET_BLOCK_TRACKING);
12924
          return () => {
12925
              const cur = context.currentNode;
12926
              if (cur.codegenNode) {
12927
                  cur.codegenNode = context.cache(cur.codegenNode, true /* isVNode */);
12928
              }
12929
          };
12930
      }
12931
  };
12932
 
12933
  const transformModel = (dir, node, context) => {
12934
      const { exp, arg } = dir;
12935
      if (!exp) {
12936
          context.onError(createCompilerError(40 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
12937
          return createTransformProps();
12938
      }
12939
      const rawExp = exp.loc.source;
12940
      const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
12941
      // im SFC <script setup> inline mode, the exp may have been transformed into
12942
      // _unref(exp)
12943
      const bindingType = context.bindingMetadata[rawExp];
12944
      const maybeRef = !true    /* SETUP_CONST */;
12945
      if (!isMemberExpression(expString) && !maybeRef) {
12946
          context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
12947
          return createTransformProps();
12948
      }
12949
      const propName = arg ? arg : createSimpleExpression('modelValue', true);
12950
      const eventName = arg
12951
          ? isStaticExp(arg)
12952
              ? `onUpdate:${arg.content}`
12953
              : createCompoundExpression(['"onUpdate:" + ', arg])
12954
          : `onUpdate:modelValue`;
12955
      let assignmentExp;
12956
      const eventArg = context.isTS ? `($event: any)` : `$event`;
12957
      {
12958
          assignmentExp = createCompoundExpression([
12959
              `${eventArg} => (`,
12960
              exp,
12961
              ` = $event)`
12962
          ]);
12963
      }
12964
      const props = [
12965
          // modelValue: foo
12966
          createObjectProperty(propName, dir.exp),
12967
          // "onUpdate:modelValue": $event => (foo = $event)
12968
          createObjectProperty(eventName, assignmentExp)
12969
      ];
12970
      // modelModifiers: { foo: true, "bar-baz": true }
12971
      if (dir.modifiers.length && node.tagType === 1 /* COMPONENT */) {
12972
          const modifiers = dir.modifiers
12973
              .map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
12974
              .join(`, `);
12975
          const modifiersKey = arg
12976
              ? isStaticExp(arg)
12977
                  ? `${arg.content}Modifiers`
12978
                  : createCompoundExpression([arg, ' + "Modifiers"'])
12979
              : `modelModifiers`;
12980
          props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* CAN_HOIST */)));
12981
      }
12982
      return createTransformProps(props);
12983
  };
12984
  function createTransformProps(props = []) {
12985
      return { props };
12986
  }
12987
 
12988
  function getBaseTransformPreset(prefixIdentifiers) {
12989
      return [
12990
          [
12991
              transformOnce,
12992
              transformIf,
12993
              transformFor,
12994
              ...(  [transformExpression]
12995
                      ),
12996
              transformSlotOutlet,
12997
              transformElement,
12998
              trackSlotScopes,
12999
              transformText
13000
          ],
13001
          {
13002
              on: transformOn,
13003
              bind: transformBind,
13004
              model: transformModel
13005
          }
13006
      ];
13007
  }
13008
  // we name it `baseCompile` so that higher order compilers like
13009
  // @vue/compiler-dom can export `compile` while re-exporting everything else.
13010
  function baseCompile(template, options = {}) {
13011
      const onError = options.onError || defaultOnError;
13012
      const isModuleMode = options.mode === 'module';
13013
      /* istanbul ignore if */
13014
      {
13015
          if (options.prefixIdentifiers === true) {
13016
              onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
13017
          }
13018
          else if (isModuleMode) {
13019
              onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
13020
          }
13021
      }
13022
      const prefixIdentifiers = !true ;
13023
      if ( options.cacheHandlers) {
13024
          onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
13025
      }
13026
      if (options.scopeId && !isModuleMode) {
13027
          onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
13028
      }
13029
      const ast = isString(template) ? baseParse(template, options) : template;
13030
      const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
13031
      transform(ast, extend({}, options, {
13032
          prefixIdentifiers,
13033
          nodeTransforms: [
13034
              ...nodeTransforms,
13035
              ...(options.nodeTransforms || []) // user transforms
13036
          ],
13037
          directiveTransforms: extend({}, directiveTransforms, options.directiveTransforms || {} // user transforms
13038
          )
13039
      }));
13040
      return generate(ast, extend({}, options, {
13041
          prefixIdentifiers
13042
      }));
13043
  }
13044
 
13045
  const noopDirectiveTransform = () => ({ props: [] });
13046
 
13047
  const V_MODEL_RADIO = Symbol( `vModelRadio` );
13048
  const V_MODEL_CHECKBOX = Symbol( `vModelCheckbox` );
13049
  const V_MODEL_TEXT = Symbol( `vModelText` );
13050
  const V_MODEL_SELECT = Symbol( `vModelSelect` );
13051
  const V_MODEL_DYNAMIC = Symbol( `vModelDynamic` );
13052
  const V_ON_WITH_MODIFIERS = Symbol( `vOnModifiersGuard` );
13053
  const V_ON_WITH_KEYS = Symbol( `vOnKeysGuard` );
13054
  const V_SHOW = Symbol( `vShow` );
13055
  const TRANSITION$1 = Symbol( `Transition` );
13056
  const TRANSITION_GROUP = Symbol( `TransitionGroup` );
13057
  registerRuntimeHelpers({
13058
      [V_MODEL_RADIO]: `vModelRadio`,
13059
      [V_MODEL_CHECKBOX]: `vModelCheckbox`,
13060
      [V_MODEL_TEXT]: `vModelText`,
13061
      [V_MODEL_SELECT]: `vModelSelect`,
13062
      [V_MODEL_DYNAMIC]: `vModelDynamic`,
13063
      [V_ON_WITH_MODIFIERS]: `withModifiers`,
13064
      [V_ON_WITH_KEYS]: `withKeys`,
13065
      [V_SHOW]: `vShow`,
13066
      [TRANSITION$1]: `Transition`,
13067
      [TRANSITION_GROUP]: `TransitionGroup`
13068
  });
13069
 
13070
  /* eslint-disable no-restricted-globals */
13071
  let decoder;
13072
  function decodeHtmlBrowser(raw) {
13073
      (decoder || (decoder = document.createElement('div'))).innerHTML = raw;
13074
      return decoder.textContent;
13075
  }
13076
 
13077
  const isRawTextContainer = /*#__PURE__*/ makeMap('style,iframe,script,noscript', true);
13078
  const parserOptions = {
13079
      isVoidTag,
13080
      isNativeTag: tag => isHTMLTag(tag) || isSVGTag(tag),
13081
      isPreTag: tag => tag === 'pre',
13082
      decodeEntities:  decodeHtmlBrowser ,
13083
      isBuiltInComponent: (tag) => {
13084
          if (isBuiltInType(tag, `Transition`)) {
13085
              return TRANSITION$1;
13086
          }
13087
          else if (isBuiltInType(tag, `TransitionGroup`)) {
13088
              return TRANSITION_GROUP;
13089
          }
13090
      },
13091
      // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
13092
      getNamespace(tag, parent) {
13093
          let ns = parent ? parent.ns : 0 /* HTML */;
13094
          if (parent && ns === 2 /* MATH_ML */) {
13095
              if (parent.tag === 'annotation-xml') {
13096
                  if (tag === 'svg') {
13097
                      return 1 /* SVG */;
13098
                  }
13099
                  if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
13100
                      a.name === 'encoding' &&
13101
                      a.value != null &&
13102
                      (a.value.content === 'text/html' ||
13103
                          a.value.content === 'application/xhtml+xml'))) {
13104
                      ns = 0 /* HTML */;
13105
                  }
13106
              }
13107
              else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
13108
                  tag !== 'mglyph' &&
13109
                  tag !== 'malignmark') {
13110
                  ns = 0 /* HTML */;
13111
              }
13112
          }
13113
          else if (parent && ns === 1 /* SVG */) {
13114
              if (parent.tag === 'foreignObject' ||
13115
                  parent.tag === 'desc' ||
13116
                  parent.tag === 'title') {
13117
                  ns = 0 /* HTML */;
13118
              }
13119
          }
13120
          if (ns === 0 /* HTML */) {
13121
              if (tag === 'svg') {
13122
                  return 1 /* SVG */;
13123
              }
13124
              if (tag === 'math') {
13125
                  return 2 /* MATH_ML */;
13126
              }
13127
          }
13128
          return ns;
13129
      },
13130
      // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
13131
      getTextMode({ tag, ns }) {
13132
          if (ns === 0 /* HTML */) {
13133
              if (tag === 'textarea' || tag === 'title') {
13134
                  return 1 /* RCDATA */;
13135
              }
13136
              if (isRawTextContainer(tag)) {
13137
                  return 2 /* RAWTEXT */;
13138
              }
13139
          }
13140
          return 0 /* DATA */;
13141
      }
13142
  };
13143
 
13144
  // Parse inline CSS strings for static style attributes into an object.
13145
  // This is a NodeTransform since it works on the static `style` attribute and
13146
  // converts it into a dynamic equivalent:
13147
  // style="color: red" -> :style='{ "color": "red" }'
13148
  // It is then processed by `transformElement` and included in the generated
13149
  // props.
13150
  const transformStyle = node => {
13151
      if (node.type === 1 /* ELEMENT */) {
13152
          node.props.forEach((p, i) => {
13153
              if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
13154
                  // replace p with an expression node
13155
                  node.props[i] = {
13156
                      type: 7 /* DIRECTIVE */,
13157
                      name: `bind`,
13158
                      arg: createSimpleExpression(`style`, true, p.loc),
13159
                      exp: parseInlineCSS(p.value.content, p.loc),
13160
                      modifiers: [],
13161
                      loc: p.loc
13162
                  };
13163
              }
13164
          });
13165
      }
13166
  };
13167
  const parseInlineCSS = (cssText, loc) => {
13168
      const normalized = parseStringStyle(cssText);
13169
      return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
13170
  };
13171
 
13172
  function createDOMCompilerError(code, loc) {
13173
      return createCompilerError(code, loc,  DOMErrorMessages );
13174
  }
13175
  const DOMErrorMessages = {
13176
      [49 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
13177
      [50 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
13178
      [51 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
13179
      [52 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
13180
      [53 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
13181
      [54 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
13182
      [55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
13183
      [56 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
13184
      [57 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
13185
      [58 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
13186
      [59 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
13187
  };
13188
 
13189
  const transformVHtml = (dir, node, context) => {
13190
      const { exp, loc } = dir;
13191
      if (!exp) {
13192
          context.onError(createDOMCompilerError(49 /* X_V_HTML_NO_EXPRESSION */, loc));
13193
      }
13194
      if (node.children.length) {
13195
          context.onError(createDOMCompilerError(50 /* X_V_HTML_WITH_CHILDREN */, loc));
13196
          node.children.length = 0;
13197
      }
13198
      return {
13199
          props: [
13200
              createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression('', true))
13201
          ]
13202
      };
13203
  };
13204
 
13205
  const transformVText = (dir, node, context) => {
13206
      const { exp, loc } = dir;
13207
      if (!exp) {
13208
          context.onError(createDOMCompilerError(51 /* X_V_TEXT_NO_EXPRESSION */, loc));
13209
      }
13210
      if (node.children.length) {
13211
          context.onError(createDOMCompilerError(52 /* X_V_TEXT_WITH_CHILDREN */, loc));
13212
          node.children.length = 0;
13213
      }
13214
      return {
13215
          props: [
13216
              createObjectProperty(createSimpleExpression(`textContent`, true), exp
13217
                  ? createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
13218
                  : createSimpleExpression('', true))
13219
          ]
13220
      };
13221
  };
13222
 
13223
  const transformModel$1 = (dir, node, context) => {
13224
      const baseResult = transformModel(dir, node, context);
13225
      // base transform has errors OR component v-model (only need props)
13226
      if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
13227
          return baseResult;
13228
      }
13229
      if (dir.arg) {
13230
          context.onError(createDOMCompilerError(54 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
13231
      }
13232
      function checkDuplicatedValue() {
13233
          const value = findProp(node, 'value');
13234
          if (value) {
13235
              context.onError(createDOMCompilerError(56 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
13236
          }
13237
      }
13238
      const { tag } = node;
13239
      const isCustomElement = context.isCustomElement(tag);
13240
      if (tag === 'input' ||
13241
          tag === 'textarea' ||
13242
          tag === 'select' ||
13243
          isCustomElement) {
13244
          let directiveToUse = V_MODEL_TEXT;
13245
          let isInvalidType = false;
13246
          if (tag === 'input' || isCustomElement) {
13247
              const type = findProp(node, `type`);
13248
              if (type) {
13249
                  if (type.type === 7 /* DIRECTIVE */) {
13250
                      // :type="foo"
13251
                      directiveToUse = V_MODEL_DYNAMIC;
13252
                  }
13253
                  else if (type.value) {
13254
                      switch (type.value.content) {
13255
                          case 'radio':
13256
                              directiveToUse = V_MODEL_RADIO;
13257
                              break;
13258
                          case 'checkbox':
13259
                              directiveToUse = V_MODEL_CHECKBOX;
13260
                              break;
13261
                          case 'file':
13262
                              isInvalidType = true;
13263
                              context.onError(createDOMCompilerError(55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
13264
                              break;
13265
                          default:
13266
                              // text type
13267
                               checkDuplicatedValue();
13268
                              break;
13269
                      }
13270
                  }
13271
              }
13272
              else if (hasDynamicKeyVBind(node)) {
13273
                  // element has bindings with dynamic keys, which can possibly contain
13274
                  // "type".
13275
                  directiveToUse = V_MODEL_DYNAMIC;
13276
              }
13277
              else {
13278
                  // text type
13279
                   checkDuplicatedValue();
13280
              }
13281
          }
13282
          else if (tag === 'select') {
13283
              directiveToUse = V_MODEL_SELECT;
13284
          }
13285
          else {
13286
              // textarea
13287
               checkDuplicatedValue();
13288
          }
13289
          // inject runtime directive
13290
          // by returning the helper symbol via needRuntime
13291
          // the import will replaced a resolveDirective call.
13292
          if (!isInvalidType) {
13293
              baseResult.needRuntime = context.helper(directiveToUse);
13294
          }
13295
      }
13296
      else {
13297
          context.onError(createDOMCompilerError(53 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
13298
      }
13299
      // native vmodel doesn't need the `modelValue` props since they are also
13300
      // passed to the runtime as `binding.value`. removing it reduces code size.
13301
      baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
13302
          p.key.content === 'modelValue'));
13303
      return baseResult;
13304
  };
13305
 
13306
  const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`);
13307
  const isNonKeyModifier = /*#__PURE__*/ makeMap(
13308
  // event propagation management
13309
`stop,prevent,self,`   +
13310
      // system modifiers + exact
13311
      `ctrl,shift,alt,meta,exact,` +
13312
      // mouse
13313
      `middle`);
13314
  // left & right could be mouse or key modifiers based on event type
13315
  const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right');
13316
  const isKeyboardEvent = /*#__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`, true);
13317
  const resolveModifiers = (key, modifiers) => {
13318
      const keyModifiers = [];
13319
      const nonKeyModifiers = [];
13320
      const eventOptionModifiers = [];
13321
      for (let i = 0; i < modifiers.length; i++) {
13322
          const modifier = modifiers[i];
13323
          if (isEventOptionModifier(modifier)) {
13324
              // eventOptionModifiers: modifiers for addEventListener() options,
13325
              // e.g. .passive & .capture
13326
              eventOptionModifiers.push(modifier);
13327
          }
13328
          else {
13329
              // runtimeModifiers: modifiers that needs runtime guards
13330
              if (maybeKeyModifier(modifier)) {
13331
                  if (isStaticExp(key)) {
13332
                      if (isKeyboardEvent(key.content)) {
13333
                          keyModifiers.push(modifier);
13334
                      }
13335
                      else {
13336
                          nonKeyModifiers.push(modifier);
13337
                      }
13338
                  }
13339
                  else {
13340
                      keyModifiers.push(modifier);
13341
                      nonKeyModifiers.push(modifier);
13342
                  }
13343
              }
13344
              else {
13345
                  if (isNonKeyModifier(modifier)) {
13346
                      nonKeyModifiers.push(modifier);
13347
                  }
13348
                  else {
13349
                      keyModifiers.push(modifier);
13350
                  }
13351
              }
13352
          }
13353
      }
13354
      return {
13355
          keyModifiers,
13356
          nonKeyModifiers,
13357
          eventOptionModifiers
13358
      };
13359
  };
13360
  const transformClick = (key, event) => {
13361
      const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
13362
      return isStaticClick
13363
          ? createSimpleExpression(event, true)
13364
          : key.type !== 4 /* SIMPLE_EXPRESSION */
13365
              ? createCompoundExpression([
13366
                  `(`,
13367
                  key,
13368
                  `) === "onClick" ? "${event}" : (`,
13369
                  key,
13370
                  `)`
13371
              ])
13372
              : key;
13373
  };
13374
  const transformOn$1 = (dir, node, context) => {
13375
      return transformOn(dir, node, context, baseResult => {
13376
          const { modifiers } = dir;
13377
          if (!modifiers.length)
13378
              return baseResult;
13379
          let { key, value: handlerExp } = baseResult.props[0];
13380
          const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers);
13381
          // normalize click.right and click.middle since they don't actually fire
13382
          if (nonKeyModifiers.includes('right')) {
13383
              key = transformClick(key, `onContextmenu`);
13384
          }
13385
          if (nonKeyModifiers.includes('middle')) {
13386
              key = transformClick(key, `onMouseup`);
13387
          }
13388
          if (nonKeyModifiers.length) {
13389
              handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
13390
                  handlerExp,
13391
                  JSON.stringify(nonKeyModifiers)
13392
              ]);
13393
          }
13394
          if (keyModifiers.length &&
13395
              // if event name is dynamic, always wrap with keys guard
13396
              (!isStaticExp(key) || isKeyboardEvent(key.content))) {
13397
              handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
13398
                  handlerExp,
13399
                  JSON.stringify(keyModifiers)
13400
              ]);
13401
          }
13402
          if (eventOptionModifiers.length) {
13403
              const modifierPostfix = eventOptionModifiers.map(capitalize).join('');
13404
              key = isStaticExp(key)
13405
                  ? createSimpleExpression(`${key.content}${modifierPostfix}`, true)
13406
                  : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
13407
          }
13408
          return {
13409
              props: [createObjectProperty(key, handlerExp)]
13410
          };
13411
      });
13412
  };
13413
 
13414
  const transformShow = (dir, node, context) => {
13415
      const { exp, loc } = dir;
13416
      if (!exp) {
13417
          context.onError(createDOMCompilerError(57 /* X_V_SHOW_NO_EXPRESSION */, loc));
13418
      }
13419
      return {
13420
          props: [],
13421
          needRuntime: context.helper(V_SHOW)
13422
      };
13423
  };
13424
 
13425
  const warnTransitionChildren = (node, context) => {
13426
      if (node.type === 1 /* ELEMENT */ &&
13427
          node.tagType === 1 /* COMPONENT */) {
13428
          const component = context.isBuiltInComponent(node.tag);
13429
          if (component === TRANSITION$1) {
13430
              return () => {
13431
                  if (node.children.length && hasMultipleChildren(node)) {
13432
                      context.onError(createDOMCompilerError(58 /* X_TRANSITION_INVALID_CHILDREN */, {
13433
                          start: node.children[0].loc.start,
13434
                          end: node.children[node.children.length - 1].loc.end,
13435
                          source: ''
13436
                      }));
13437
                  }
13438
              };
13439
          }
13440
      }
13441
  };
13442
  function hasMultipleChildren(node) {
13443
      // #1352 filter out potential comment nodes.
13444
      const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */));
13445
      const child = children[0];
13446
      return (children.length !== 1 ||
13447
          child.type === 11 /* FOR */ ||
13448
          (child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
13449
  }
13450
 
13451
  const ignoreSideEffectTags = (node, context) => {
13452
      if (node.type === 1 /* ELEMENT */ &&
13453
          node.tagType === 0 /* ELEMENT */ &&
13454
          (node.tag === 'script' || node.tag === 'style')) {
13455
          context.onError(createDOMCompilerError(59 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
13456
          context.removeNode();
13457
      }
13458
  };
13459
 
13460
  const DOMNodeTransforms = [
13461
      transformStyle,
13462
      ...( [warnTransitionChildren] )
13463
  ];
13464
  const DOMDirectiveTransforms = {
13465
      cloak: noopDirectiveTransform,
13466
      html: transformVHtml,
13467
      text: transformVText,
13468
      model: transformModel$1,
13469
      on: transformOn$1,
13470
      show: transformShow
13471
  };
13472
  function compile$1(template, options = {}) {
13473
      return baseCompile(template, extend({}, parserOptions, options, {
13474
          nodeTransforms: [
13475
              // ignore <script> and <tag>
13476
              // this is not put inside DOMNodeTransforms because that list is used
13477
              // by compiler-ssr to generate vnode fallback branches
13478
              ignoreSideEffectTags,
13479
              ...DOMNodeTransforms,
13480
              ...(options.nodeTransforms || [])
13481
          ],
13482
          directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
13483
          transformHoist:  null
13484
      }));
13485
  }
13486
 
13487
  // This entry is the "full-build" that includes both the runtime
13488
   initDev();
13489
  const compileCache = Object.create(null);
13490
  function compileToFunction(template, options) {
13491
      if (!isString(template)) {
13492
          if (template.nodeType) {
13493
              template = template.innerHTML;
13494
          }
13495
          else {
13496
               warn(`invalid template option: `, template);
13497
              return NOOP;
13498
          }
13499
      }
13500
      const key = template;
13501
      const cached = compileCache[key];
13502
      if (cached) {
13503
          return cached;
13504
      }
13505
      if (template[0] === '#') {
13506
          const el = document.querySelector(template);
13507
          if ( !el) {
13508
              warn(`Template element not found or is empty: ${template}`);
13509
          }
13510
          // __UNSAFE__
13511
          // Reason: potential execution of JS expressions in in-DOM template.
13512
          // The user must make sure the in-DOM template is trusted. If it's rendered
13513
          // by the server, the template should not contain any user data.
13514
          template = el ? el.innerHTML : ``;
13515
      }
13516
      const { code } = compile$1(template, extend({
13517
          hoistStatic: true,
13518
          onError(err) {
13519
              {
13520
                  const message = `Template compilation error: ${err.message}`;
13521
                  const codeFrame = err.loc &&
13522
                      generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
13523
                  warn(codeFrame ? `${message}\n${codeFrame}` : message);
13524
              }
13525
          }
13526
      }, options));
13527
      // The wildcard import results in a huge object with every export
13528
      // with keys that cannot be mangled, and can be quite heavy size-wise.
13529
      // In the global build we know `Vue` is available globally so we can avoid
13530
      // the wildcard object.
13531
      const render = ( new Function(code)()
13532
          );
13533
      render._rc = true;
13534
      return (compileCache[key] = render);
13535
  }
13536
  registerRuntimeCompiler(compileToFunction);
13537
 
13538
  exports.BaseTransition = BaseTransition;
13539
  exports.Comment = Comment;
13540
  exports.Fragment = Fragment;
13541
  exports.KeepAlive = KeepAlive;
13542
  exports.Static = Static;
13543
  exports.Suspense = Suspense;
13544
  exports.Teleport = Teleport;
13545
  exports.Text = Text;
13546
  exports.Transition = Transition;
13547
  exports.TransitionGroup = TransitionGroup;
13548
  exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
13549
  exports.callWithErrorHandling = callWithErrorHandling;
13550
  exports.camelize = camelize;
13551
  exports.capitalize = capitalize;
13552
  exports.cloneVNode = cloneVNode;
13553
  exports.compile = compileToFunction;
13554
  exports.computed = computed$1;
13555
  exports.createApp = createApp;
13556
  exports.createBlock = createBlock;
13557
  exports.createCommentVNode = createCommentVNode;
13558
  exports.createHydrationRenderer = createHydrationRenderer;
13559
  exports.createRenderer = createRenderer;
13560
  exports.createSSRApp = createSSRApp;
13561
  exports.createSlots = createSlots;
13562
  exports.createStaticVNode = createStaticVNode;
13563
  exports.createTextVNode = createTextVNode;
13564
  exports.createVNode = createVNode;
13565
  exports.customRef = customRef;
13566
  exports.defineAsyncComponent = defineAsyncComponent;
13567
  exports.defineComponent = defineComponent;
13568
  exports.defineEmit = defineEmit;
13569
  exports.defineProps = defineProps;
13570
  exports.getCurrentInstance = getCurrentInstance;
13571
  exports.getTransitionRawChildren = getTransitionRawChildren;
13572
  exports.h = h;
13573
  exports.handleError = handleError;
13574
  exports.hydrate = hydrate;
13575
  exports.initCustomFormatter = initCustomFormatter;
13576
  exports.inject = inject;
13577
  exports.isProxy = isProxy;
13578
  exports.isReactive = isReactive;
13579
  exports.isReadonly = isReadonly;
13580
  exports.isRef = isRef;
13581
  exports.isVNode = isVNode;
13582
  exports.markRaw = markRaw;
13583
  exports.mergeProps = mergeProps;
13584
  exports.nextTick = nextTick;
13585
  exports.onActivated = onActivated;
13586
  exports.onBeforeMount = onBeforeMount;
13587
  exports.onBeforeUnmount = onBeforeUnmount;
13588
  exports.onBeforeUpdate = onBeforeUpdate;
13589
  exports.onDeactivated = onDeactivated;
13590
  exports.onErrorCaptured = onErrorCaptured;
13591
  exports.onMounted = onMounted;
13592
  exports.onRenderTracked = onRenderTracked;
13593
  exports.onRenderTriggered = onRenderTriggered;
13594
  exports.onUnmounted = onUnmounted;
13595
  exports.onUpdated = onUpdated;
13596
  exports.openBlock = openBlock;
13597
  exports.popScopeId = popScopeId;
13598
  exports.provide = provide;
13599
  exports.proxyRefs = proxyRefs;
13600
  exports.pushScopeId = pushScopeId;
13601
  exports.queuePostFlushCb = queuePostFlushCb;
13602
  exports.reactive = reactive;
13603
  exports.readonly = readonly;
13604
  exports.ref = ref;
13605
  exports.registerRuntimeCompiler = registerRuntimeCompiler;
13606
  exports.render = render;
13607
  exports.renderList = renderList;
13608
  exports.renderSlot = renderSlot;
13609
  exports.resolveComponent = resolveComponent;
13610
  exports.resolveDirective = resolveDirective;
13611
  exports.resolveDynamicComponent = resolveDynamicComponent;
13612
  exports.resolveTransitionHooks = resolveTransitionHooks;
13613
  exports.setBlockTracking = setBlockTracking;
13614
  exports.setDevtoolsHook = setDevtoolsHook;
13615
  exports.setTransitionHooks = setTransitionHooks;
13616
  exports.shallowReactive = shallowReactive;
13617
  exports.shallowReadonly = shallowReadonly;
13618
  exports.shallowRef = shallowRef;
13619
  exports.ssrContextKey = ssrContextKey;
13620
  exports.ssrUtils = ssrUtils;
13621
  exports.toDisplayString = toDisplayString;
13622
  exports.toHandlerKey = toHandlerKey;
13623
  exports.toHandlers = toHandlers;
13624
  exports.toRaw = toRaw;
13625
  exports.toRef = toRef;
13626
  exports.toRefs = toRefs;
13627
  exports.transformVNodeArgs = transformVNodeArgs;
13628
  exports.triggerRef = triggerRef;
13629
  exports.unref = unref;
13630
  exports.useContext = useContext;
13631
  exports.useCssModule = useCssModule;
13632
  exports.useCssVars = useCssVars;
13633
  exports.useSSRContext = useSSRContext;
13634
  exports.useTransitionState = useTransitionState;
13635
  exports.vModelCheckbox = vModelCheckbox;
13636
  exports.vModelDynamic = vModelDynamic;
13637
  exports.vModelRadio = vModelRadio;
13638
  exports.vModelSelect = vModelSelect;
13639
  exports.vModelText = vModelText;
13640
  exports.vShow = vShow;
13641
  exports.version = version;
13642
  exports.warn = warn;
13643
  exports.watch = watch;
13644
  exports.watchEffect = watchEffect;
13645
  exports.withCtx = withCtx;
13646
  exports.withDirectives = withDirectives;
13647
  exports.withKeys = withKeys;
13648
  exports.withModifiers = withModifiers;
13649
  exports.withScopeId = withScopeId;
13650
 
13651
  Object.defineProperty(exports, '__esModule', { value: true });
13652
 
13653
  return exports;
13654
 
13655
}({}));