UNPKG

291 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.7.15
3 * (c) 2014-2023 Evan You
4 * Released under the MIT License.
5 */
6'use strict';
7
8const emptyObject = Object.freeze({});
9const isArray = Array.isArray;
10// These helpers produce better VM code in JS engines due to their
11// explicitness and function inlining.
12function isUndef(v) {
13 return v === undefined || v === null;
14}
15function isDef(v) {
16 return v !== undefined && v !== null;
17}
18function isTrue(v) {
19 return v === true;
20}
21function isFalse(v) {
22 return v === false;
23}
24/**
25 * Check if value is primitive.
26 */
27function isPrimitive(value) {
28 return (typeof value === 'string' ||
29 typeof value === 'number' ||
30 // $flow-disable-line
31 typeof value === 'symbol' ||
32 typeof value === 'boolean');
33}
34function isFunction(value) {
35 return typeof value === 'function';
36}
37/**
38 * Quick object check - this is primarily used to tell
39 * objects from primitive values when we know the value
40 * is a JSON-compliant type.
41 */
42function isObject(obj) {
43 return obj !== null && typeof obj === 'object';
44}
45/**
46 * Get the raw type string of a value, e.g., [object Object].
47 */
48const _toString = Object.prototype.toString;
49function toRawType(value) {
50 return _toString.call(value).slice(8, -1);
51}
52/**
53 * Strict object type check. Only returns true
54 * for plain JavaScript objects.
55 */
56function isPlainObject(obj) {
57 return _toString.call(obj) === '[object Object]';
58}
59function isRegExp(v) {
60 return _toString.call(v) === '[object RegExp]';
61}
62/**
63 * Check if val is a valid array index.
64 */
65function isValidArrayIndex(val) {
66 const n = parseFloat(String(val));
67 return n >= 0 && Math.floor(n) === n && isFinite(val);
68}
69function isPromise(val) {
70 return (isDef(val) &&
71 typeof val.then === 'function' &&
72 typeof val.catch === 'function');
73}
74/**
75 * Convert a value to a string that is actually rendered.
76 */
77function toString(val) {
78 return val == null
79 ? ''
80 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
81 ? JSON.stringify(val, null, 2)
82 : String(val);
83}
84/**
85 * Convert an input value to a number for persistence.
86 * If the conversion fails, return original string.
87 */
88function toNumber(val) {
89 const n = parseFloat(val);
90 return isNaN(n) ? val : n;
91}
92/**
93 * Make a map and return a function for checking if a key
94 * is in that map.
95 */
96function makeMap(str, expectsLowerCase) {
97 const map = Object.create(null);
98 const list = str.split(',');
99 for (let i = 0; i < list.length; i++) {
100 map[list[i]] = true;
101 }
102 return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val];
103}
104/**
105 * Check if a tag is a built-in tag.
106 */
107const isBuiltInTag = makeMap('slot,component', true);
108/**
109 * Check if an attribute is a reserved attribute.
110 */
111const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
112/**
113 * Remove an item from an array.
114 */
115function remove$2(arr, item) {
116 const len = arr.length;
117 if (len) {
118 // fast path for the only / last item
119 if (item === arr[len - 1]) {
120 arr.length = len - 1;
121 return;
122 }
123 const index = arr.indexOf(item);
124 if (index > -1) {
125 return arr.splice(index, 1);
126 }
127 }
128}
129/**
130 * Check whether an object has the property.
131 */
132const hasOwnProperty = Object.prototype.hasOwnProperty;
133function hasOwn(obj, key) {
134 return hasOwnProperty.call(obj, key);
135}
136/**
137 * Create a cached version of a pure function.
138 */
139function cached(fn) {
140 const cache = Object.create(null);
141 return function cachedFn(str) {
142 const hit = cache[str];
143 return hit || (cache[str] = fn(str));
144 };
145}
146/**
147 * Camelize a hyphen-delimited string.
148 */
149const camelizeRE = /-(\w)/g;
150const camelize = cached((str) => {
151 return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
152});
153/**
154 * Capitalize a string.
155 */
156const capitalize = cached((str) => {
157 return str.charAt(0).toUpperCase() + str.slice(1);
158});
159/**
160 * Hyphenate a camelCase string.
161 */
162const hyphenateRE = /\B([A-Z])/g;
163const hyphenate = cached((str) => {
164 return str.replace(hyphenateRE, '-$1').toLowerCase();
165});
166/**
167 * Simple bind polyfill for environments that do not support it,
168 * e.g., PhantomJS 1.x. Technically, we don't need this anymore
169 * since native bind is now performant enough in most browsers.
170 * But removing it would mean breaking code that was able to run in
171 * PhantomJS 1.x, so this must be kept for backward compatibility.
172 */
173/* istanbul ignore next */
174function polyfillBind(fn, ctx) {
175 function boundFn(a) {
176 const l = arguments.length;
177 return l
178 ? l > 1
179 ? fn.apply(ctx, arguments)
180 : fn.call(ctx, a)
181 : fn.call(ctx);
182 }
183 boundFn._length = fn.length;
184 return boundFn;
185}
186function nativeBind(fn, ctx) {
187 return fn.bind(ctx);
188}
189// @ts-expect-error bind cannot be `undefined`
190const bind = Function.prototype.bind ? nativeBind : polyfillBind;
191/**
192 * Convert an Array-like object to a real Array.
193 */
194function toArray(list, start) {
195 start = start || 0;
196 let i = list.length - start;
197 const ret = new Array(i);
198 while (i--) {
199 ret[i] = list[i + start];
200 }
201 return ret;
202}
203/**
204 * Mix properties into target object.
205 */
206function extend(to, _from) {
207 for (const key in _from) {
208 to[key] = _from[key];
209 }
210 return to;
211}
212/**
213 * Merge an Array of Objects into a single Object.
214 */
215function toObject(arr) {
216 const res = {};
217 for (let i = 0; i < arr.length; i++) {
218 if (arr[i]) {
219 extend(res, arr[i]);
220 }
221 }
222 return res;
223}
224/* eslint-disable no-unused-vars */
225/**
226 * Perform no operation.
227 * Stubbing args to make Flow happy without leaving useless transpiled code
228 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
229 */
230function noop(a, b, c) { }
231/**
232 * Always return false.
233 */
234const no = (a, b, c) => false;
235/* eslint-enable no-unused-vars */
236/**
237 * Return the same value.
238 */
239const identity = (_) => _;
240/**
241 * Check if two values are loosely equal - that is,
242 * if they are plain objects, do they have the same shape?
243 */
244function looseEqual(a, b) {
245 if (a === b)
246 return true;
247 const isObjectA = isObject(a);
248 const isObjectB = isObject(b);
249 if (isObjectA && isObjectB) {
250 try {
251 const isArrayA = Array.isArray(a);
252 const isArrayB = Array.isArray(b);
253 if (isArrayA && isArrayB) {
254 return (a.length === b.length &&
255 a.every((e, i) => {
256 return looseEqual(e, b[i]);
257 }));
258 }
259 else if (a instanceof Date && b instanceof Date) {
260 return a.getTime() === b.getTime();
261 }
262 else if (!isArrayA && !isArrayB) {
263 const keysA = Object.keys(a);
264 const keysB = Object.keys(b);
265 return (keysA.length === keysB.length &&
266 keysA.every(key => {
267 return looseEqual(a[key], b[key]);
268 }));
269 }
270 else {
271 /* istanbul ignore next */
272 return false;
273 }
274 }
275 catch (e) {
276 /* istanbul ignore next */
277 return false;
278 }
279 }
280 else if (!isObjectA && !isObjectB) {
281 return String(a) === String(b);
282 }
283 else {
284 return false;
285 }
286}
287/**
288 * Return the first index at which a loosely equal value can be
289 * found in the array (if value is a plain object, the array must
290 * contain an object of the same shape), or -1 if it is not present.
291 */
292function looseIndexOf(arr, val) {
293 for (let i = 0; i < arr.length; i++) {
294 if (looseEqual(arr[i], val))
295 return i;
296 }
297 return -1;
298}
299/**
300 * Ensure a function is called only once.
301 */
302function once(fn) {
303 let called = false;
304 return function () {
305 if (!called) {
306 called = true;
307 fn.apply(this, arguments);
308 }
309 };
310}
311// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
312function hasChanged(x, y) {
313 if (x === y) {
314 return x === 0 && 1 / x !== 1 / y;
315 }
316 else {
317 return x === x || y === y;
318 }
319}
320
321const SSR_ATTR = 'data-server-rendered';
322const ASSET_TYPES = ['component', 'directive', 'filter'];
323const LIFECYCLE_HOOKS = [
324 'beforeCreate',
325 'created',
326 'beforeMount',
327 'mounted',
328 'beforeUpdate',
329 'updated',
330 'beforeDestroy',
331 'destroyed',
332 'activated',
333 'deactivated',
334 'errorCaptured',
335 'serverPrefetch',
336 'renderTracked',
337 'renderTriggered'
338];
339
340var config = {
341 /**
342 * Option merge strategies (used in core/util/options)
343 */
344 // $flow-disable-line
345 optionMergeStrategies: Object.create(null),
346 /**
347 * Whether to suppress warnings.
348 */
349 silent: false,
350 /**
351 * Show production mode tip message on boot?
352 */
353 productionTip: true,
354 /**
355 * Whether to enable devtools
356 */
357 devtools: true,
358 /**
359 * Whether to record perf
360 */
361 performance: false,
362 /**
363 * Error handler for watcher errors
364 */
365 errorHandler: null,
366 /**
367 * Warn handler for watcher warns
368 */
369 warnHandler: null,
370 /**
371 * Ignore certain custom elements
372 */
373 ignoredElements: [],
374 /**
375 * Custom user key aliases for v-on
376 */
377 // $flow-disable-line
378 keyCodes: Object.create(null),
379 /**
380 * Check if a tag is reserved so that it cannot be registered as a
381 * component. This is platform-dependent and may be overwritten.
382 */
383 isReservedTag: no,
384 /**
385 * Check if an attribute is reserved so that it cannot be used as a component
386 * prop. This is platform-dependent and may be overwritten.
387 */
388 isReservedAttr: no,
389 /**
390 * Check if a tag is an unknown element.
391 * Platform-dependent.
392 */
393 isUnknownElement: no,
394 /**
395 * Get the namespace of an element
396 */
397 getTagNamespace: noop,
398 /**
399 * Parse the real tag name for the specific platform.
400 */
401 parsePlatformTagName: identity,
402 /**
403 * Check if an attribute must be bound using property, e.g. value
404 * Platform-dependent.
405 */
406 mustUseProp: no,
407 /**
408 * Perform updates asynchronously. Intended to be used by Vue Test Utils
409 * This will significantly reduce performance if set to false.
410 */
411 async: true,
412 /**
413 * Exposed for legacy reasons
414 */
415 _lifecycleHooks: LIFECYCLE_HOOKS
416};
417
418/**
419 * unicode letters used for parsing html tags, component names and property paths.
420 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
421 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
422 */
423const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
424/**
425 * Check if a string starts with $ or _
426 */
427function isReserved(str) {
428 const c = (str + '').charCodeAt(0);
429 return c === 0x24 || c === 0x5f;
430}
431/**
432 * Define a property.
433 */
434function def(obj, key, val, enumerable) {
435 Object.defineProperty(obj, key, {
436 value: val,
437 enumerable: !!enumerable,
438 writable: true,
439 configurable: true
440 });
441}
442/**
443 * Parse simple path.
444 */
445const bailRE = new RegExp(`[^${unicodeRegExp.source}.$_\\d]`);
446function parsePath(path) {
447 if (bailRE.test(path)) {
448 return;
449 }
450 const segments = path.split('.');
451 return function (obj) {
452 for (let i = 0; i < segments.length; i++) {
453 if (!obj)
454 return;
455 obj = obj[segments[i]];
456 }
457 return obj;
458 };
459}
460
461// can we use __proto__?
462const hasProto = '__proto__' in {};
463// Browser environment sniffing
464const inBrowser = typeof window !== 'undefined';
465const UA = inBrowser && window.navigator.userAgent.toLowerCase();
466const isIE = UA && /msie|trident/.test(UA);
467const isIE9 = UA && UA.indexOf('msie 9.0') > 0;
468const isEdge = UA && UA.indexOf('edge/') > 0;
469UA && UA.indexOf('android') > 0;
470const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
471UA && /chrome\/\d+/.test(UA) && !isEdge;
472UA && /phantomjs/.test(UA);
473const isFF = UA && UA.match(/firefox\/(\d+)/);
474// Firefox has a "watch" function on Object.prototype...
475// @ts-expect-error firebox support
476const nativeWatch = {}.watch;
477let supportsPassive = false;
478if (inBrowser) {
479 try {
480 const opts = {};
481 Object.defineProperty(opts, 'passive', {
482 get() {
483 /* istanbul ignore next */
484 supportsPassive = true;
485 }
486 }); // https://github.com/facebook/flow/issues/285
487 window.addEventListener('test-passive', null, opts);
488 }
489 catch (e) { }
490}
491// this needs to be lazy-evaled because vue may be required before
492// vue-server-renderer can set VUE_ENV
493let _isServer;
494const isServerRendering = () => {
495 if (_isServer === undefined) {
496 /* istanbul ignore if */
497 if (!inBrowser && typeof global !== 'undefined') {
498 // detect presence of vue-server-renderer and avoid
499 // Webpack shimming the process
500 _isServer =
501 global['process'] && global['process'].env.VUE_ENV === 'server';
502 }
503 else {
504 _isServer = false;
505 }
506 }
507 return _isServer;
508};
509// detect devtools
510const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
511/* istanbul ignore next */
512function isNative(Ctor) {
513 return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
514}
515const hasSymbol = typeof Symbol !== 'undefined' &&
516 isNative(Symbol) &&
517 typeof Reflect !== 'undefined' &&
518 isNative(Reflect.ownKeys);
519let _Set; // $flow-disable-line
520/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
521 // use native Set when available.
522 _Set = Set;
523}
524else {
525 // a non-standard Set polyfill that only works with primitive keys.
526 _Set = class Set {
527 constructor() {
528 this.set = Object.create(null);
529 }
530 has(key) {
531 return this.set[key] === true;
532 }
533 add(key) {
534 this.set[key] = true;
535 }
536 clear() {
537 this.set = Object.create(null);
538 }
539 };
540}
541
542let currentInstance = null;
543/**
544 * This is exposed for compatibility with v3 (e.g. some functions in VueUse
545 * relies on it). Do not use this internally, just use `currentInstance`.
546 *
547 * @internal this function needs manual type declaration because it relies
548 * on previously manually authored types from Vue 2
549 */
550function getCurrentInstance() {
551 return currentInstance && { proxy: currentInstance };
552}
553/**
554 * @internal
555 */
556function setCurrentInstance(vm = null) {
557 if (!vm)
558 currentInstance && currentInstance._scope.off();
559 currentInstance = vm;
560 vm && vm._scope.on();
561}
562
563/**
564 * @internal
565 */
566class VNode {
567 constructor(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
568 this.tag = tag;
569 this.data = data;
570 this.children = children;
571 this.text = text;
572 this.elm = elm;
573 this.ns = undefined;
574 this.context = context;
575 this.fnContext = undefined;
576 this.fnOptions = undefined;
577 this.fnScopeId = undefined;
578 this.key = data && data.key;
579 this.componentOptions = componentOptions;
580 this.componentInstance = undefined;
581 this.parent = undefined;
582 this.raw = false;
583 this.isStatic = false;
584 this.isRootInsert = true;
585 this.isComment = false;
586 this.isCloned = false;
587 this.isOnce = false;
588 this.asyncFactory = asyncFactory;
589 this.asyncMeta = undefined;
590 this.isAsyncPlaceholder = false;
591 }
592 // DEPRECATED: alias for componentInstance for backwards compat.
593 /* istanbul ignore next */
594 get child() {
595 return this.componentInstance;
596 }
597}
598const createEmptyVNode = (text = '') => {
599 const node = new VNode();
600 node.text = text;
601 node.isComment = true;
602 return node;
603};
604function createTextVNode(val) {
605 return new VNode(undefined, undefined, undefined, String(val));
606}
607// optimized shallow clone
608// used for static nodes and slot nodes because they may be reused across
609// multiple renders, cloning them avoids errors when DOM manipulations rely
610// on their elm reference.
611function cloneVNode(vnode) {
612 const cloned = new VNode(vnode.tag, vnode.data,
613 // #7975
614 // clone children array to avoid mutating original in case of cloning
615 // a child.
616 vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
617 cloned.ns = vnode.ns;
618 cloned.isStatic = vnode.isStatic;
619 cloned.key = vnode.key;
620 cloned.isComment = vnode.isComment;
621 cloned.fnContext = vnode.fnContext;
622 cloned.fnOptions = vnode.fnOptions;
623 cloned.fnScopeId = vnode.fnScopeId;
624 cloned.asyncMeta = vnode.asyncMeta;
625 cloned.isCloned = true;
626 return cloned;
627}
628
629let uid$2 = 0;
630const pendingCleanupDeps = [];
631const cleanupDeps = () => {
632 for (let i = 0; i < pendingCleanupDeps.length; i++) {
633 const dep = pendingCleanupDeps[i];
634 dep.subs = dep.subs.filter(s => s);
635 dep._pending = false;
636 }
637 pendingCleanupDeps.length = 0;
638};
639/**
640 * A dep is an observable that can have multiple
641 * directives subscribing to it.
642 * @internal
643 */
644class Dep {
645 constructor() {
646 // pending subs cleanup
647 this._pending = false;
648 this.id = uid$2++;
649 this.subs = [];
650 }
651 addSub(sub) {
652 this.subs.push(sub);
653 }
654 removeSub(sub) {
655 // #12696 deps with massive amount of subscribers are extremely slow to
656 // clean up in Chromium
657 // to workaround this, we unset the sub for now, and clear them on
658 // next scheduler flush.
659 this.subs[this.subs.indexOf(sub)] = null;
660 if (!this._pending) {
661 this._pending = true;
662 pendingCleanupDeps.push(this);
663 }
664 }
665 depend(info) {
666 if (Dep.target) {
667 Dep.target.addDep(this);
668 if (info && Dep.target.onTrack) {
669 Dep.target.onTrack(Object.assign({ effect: Dep.target }, info));
670 }
671 }
672 }
673 notify(info) {
674 // stabilize the subscriber list first
675 const subs = this.subs.filter(s => s);
676 if (!config.async) {
677 // subs aren't sorted in scheduler if not running async
678 // we need to sort them now to make sure they fire in correct
679 // order
680 subs.sort((a, b) => a.id - b.id);
681 }
682 for (let i = 0, l = subs.length; i < l; i++) {
683 const sub = subs[i];
684 if (info) {
685 sub.onTrigger &&
686 sub.onTrigger(Object.assign({ effect: subs[i] }, info));
687 }
688 sub.update();
689 }
690 }
691}
692// The current target watcher being evaluated.
693// This is globally unique because only one watcher
694// can be evaluated at a time.
695Dep.target = null;
696const targetStack = [];
697function pushTarget(target) {
698 targetStack.push(target);
699 Dep.target = target;
700}
701function popTarget() {
702 targetStack.pop();
703 Dep.target = targetStack[targetStack.length - 1];
704}
705
706/*
707 * not type checking this file because flow doesn't play well with
708 * dynamically accessing methods on Array prototype
709 */
710const arrayProto = Array.prototype;
711const arrayMethods = Object.create(arrayProto);
712const methodsToPatch = [
713 'push',
714 'pop',
715 'shift',
716 'unshift',
717 'splice',
718 'sort',
719 'reverse'
720];
721/**
722 * Intercept mutating methods and emit events
723 */
724methodsToPatch.forEach(function (method) {
725 // cache original method
726 const original = arrayProto[method];
727 def(arrayMethods, method, function mutator(...args) {
728 const result = original.apply(this, args);
729 const ob = this.__ob__;
730 let inserted;
731 switch (method) {
732 case 'push':
733 case 'unshift':
734 inserted = args;
735 break;
736 case 'splice':
737 inserted = args.slice(2);
738 break;
739 }
740 if (inserted)
741 ob.observeArray(inserted);
742 // notify change
743 {
744 ob.dep.notify({
745 type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
746 target: this,
747 key: method
748 });
749 }
750 return result;
751 });
752});
753
754const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
755const NO_INITIAL_VALUE = {};
756/**
757 * In some cases we may want to disable observation inside a component's
758 * update computation.
759 */
760let shouldObserve = true;
761function toggleObserving(value) {
762 shouldObserve = value;
763}
764// ssr mock dep
765const mockDep = {
766 notify: noop,
767 depend: noop,
768 addSub: noop,
769 removeSub: noop
770};
771/**
772 * Observer class that is attached to each observed
773 * object. Once attached, the observer converts the target
774 * object's property keys into getter/setters that
775 * collect dependencies and dispatch updates.
776 */
777class Observer {
778 constructor(value, shallow = false, mock = false) {
779 this.value = value;
780 this.shallow = shallow;
781 this.mock = mock;
782 // this.value = value
783 this.dep = mock ? mockDep : new Dep();
784 this.vmCount = 0;
785 def(value, '__ob__', this);
786 if (isArray(value)) {
787 if (!mock) {
788 if (hasProto) {
789 value.__proto__ = arrayMethods;
790 /* eslint-enable no-proto */
791 }
792 else {
793 for (let i = 0, l = arrayKeys.length; i < l; i++) {
794 const key = arrayKeys[i];
795 def(value, key, arrayMethods[key]);
796 }
797 }
798 }
799 if (!shallow) {
800 this.observeArray(value);
801 }
802 }
803 else {
804 /**
805 * Walk through all properties and convert them into
806 * getter/setters. This method should only be called when
807 * value type is Object.
808 */
809 const keys = Object.keys(value);
810 for (let i = 0; i < keys.length; i++) {
811 const key = keys[i];
812 defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
813 }
814 }
815 }
816 /**
817 * Observe a list of Array items.
818 */
819 observeArray(value) {
820 for (let i = 0, l = value.length; i < l; i++) {
821 observe(value[i], false, this.mock);
822 }
823 }
824}
825// helpers
826/**
827 * Attempt to create an observer instance for a value,
828 * returns the new observer if successfully observed,
829 * or the existing observer if the value already has one.
830 */
831function observe(value, shallow, ssrMockReactivity) {
832 if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
833 return value.__ob__;
834 }
835 if (shouldObserve &&
836 (ssrMockReactivity || !isServerRendering()) &&
837 (isArray(value) || isPlainObject(value)) &&
838 Object.isExtensible(value) &&
839 !value.__v_skip /* ReactiveFlags.SKIP */ &&
840 !isRef(value) &&
841 !(value instanceof VNode)) {
842 return new Observer(value, shallow, ssrMockReactivity);
843 }
844}
845/**
846 * Define a reactive property on an Object.
847 */
848function defineReactive(obj, key, val, customSetter, shallow, mock) {
849 const dep = new Dep();
850 const property = Object.getOwnPropertyDescriptor(obj, key);
851 if (property && property.configurable === false) {
852 return;
853 }
854 // cater for pre-defined getter/setters
855 const getter = property && property.get;
856 const setter = property && property.set;
857 if ((!getter || setter) &&
858 (val === NO_INITIAL_VALUE || arguments.length === 2)) {
859 val = obj[key];
860 }
861 let childOb = !shallow && observe(val, false, mock);
862 Object.defineProperty(obj, key, {
863 enumerable: true,
864 configurable: true,
865 get: function reactiveGetter() {
866 const value = getter ? getter.call(obj) : val;
867 if (Dep.target) {
868 {
869 dep.depend({
870 target: obj,
871 type: "get" /* TrackOpTypes.GET */,
872 key
873 });
874 }
875 if (childOb) {
876 childOb.dep.depend();
877 if (isArray(value)) {
878 dependArray(value);
879 }
880 }
881 }
882 return isRef(value) && !shallow ? value.value : value;
883 },
884 set: function reactiveSetter(newVal) {
885 const value = getter ? getter.call(obj) : val;
886 if (!hasChanged(value, newVal)) {
887 return;
888 }
889 if (customSetter) {
890 customSetter();
891 }
892 if (setter) {
893 setter.call(obj, newVal);
894 }
895 else if (getter) {
896 // #7981: for accessor properties without setter
897 return;
898 }
899 else if (!shallow && isRef(value) && !isRef(newVal)) {
900 value.value = newVal;
901 return;
902 }
903 else {
904 val = newVal;
905 }
906 childOb = !shallow && observe(newVal, false, mock);
907 {
908 dep.notify({
909 type: "set" /* TriggerOpTypes.SET */,
910 target: obj,
911 key,
912 newValue: newVal,
913 oldValue: value
914 });
915 }
916 }
917 });
918 return dep;
919}
920function set(target, key, val) {
921 if ((isUndef(target) || isPrimitive(target))) {
922 warn(`Cannot set reactive property on undefined, null, or primitive value: ${target}`);
923 }
924 if (isReadonly(target)) {
925 warn(`Set operation on key "${key}" failed: target is readonly.`);
926 return;
927 }
928 const ob = target.__ob__;
929 if (isArray(target) && isValidArrayIndex(key)) {
930 target.length = Math.max(target.length, key);
931 target.splice(key, 1, val);
932 // when mocking for SSR, array methods are not hijacked
933 if (ob && !ob.shallow && ob.mock) {
934 observe(val, false, true);
935 }
936 return val;
937 }
938 if (key in target && !(key in Object.prototype)) {
939 target[key] = val;
940 return val;
941 }
942 if (target._isVue || (ob && ob.vmCount)) {
943 warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
944 'at runtime - declare it upfront in the data option.');
945 return val;
946 }
947 if (!ob) {
948 target[key] = val;
949 return val;
950 }
951 defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
952 {
953 ob.dep.notify({
954 type: "add" /* TriggerOpTypes.ADD */,
955 target: target,
956 key,
957 newValue: val,
958 oldValue: undefined
959 });
960 }
961 return val;
962}
963function del(target, key) {
964 if ((isUndef(target) || isPrimitive(target))) {
965 warn(`Cannot delete reactive property on undefined, null, or primitive value: ${target}`);
966 }
967 if (isArray(target) && isValidArrayIndex(key)) {
968 target.splice(key, 1);
969 return;
970 }
971 const ob = target.__ob__;
972 if (target._isVue || (ob && ob.vmCount)) {
973 warn('Avoid deleting properties on a Vue instance or its root $data ' +
974 '- just set it to null.');
975 return;
976 }
977 if (isReadonly(target)) {
978 warn(`Delete operation on key "${key}" failed: target is readonly.`);
979 return;
980 }
981 if (!hasOwn(target, key)) {
982 return;
983 }
984 delete target[key];
985 if (!ob) {
986 return;
987 }
988 {
989 ob.dep.notify({
990 type: "delete" /* TriggerOpTypes.DELETE */,
991 target: target,
992 key
993 });
994 }
995}
996/**
997 * Collect dependencies on array elements when the array is touched, since
998 * we cannot intercept array element access like property getters.
999 */
1000function dependArray(value) {
1001 for (let e, i = 0, l = value.length; i < l; i++) {
1002 e = value[i];
1003 if (e && e.__ob__) {
1004 e.__ob__.dep.depend();
1005 }
1006 if (isArray(e)) {
1007 dependArray(e);
1008 }
1009 }
1010}
1011
1012function reactive(target) {
1013 makeReactive(target, false);
1014 return target;
1015}
1016/**
1017 * Return a shallowly-reactive copy of the original object, where only the root
1018 * level properties are reactive. It also does not auto-unwrap refs (even at the
1019 * root level).
1020 */
1021function shallowReactive(target) {
1022 makeReactive(target, true);
1023 def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
1024 return target;
1025}
1026function makeReactive(target, shallow) {
1027 // if trying to observe a readonly proxy, return the readonly version.
1028 if (!isReadonly(target)) {
1029 {
1030 if (isArray(target)) {
1031 warn(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`);
1032 }
1033 const existingOb = target && target.__ob__;
1034 if (existingOb && existingOb.shallow !== shallow) {
1035 warn(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`);
1036 }
1037 }
1038 const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
1039 if (!ob) {
1040 if (target == null || isPrimitive(target)) {
1041 warn(`value cannot be made reactive: ${String(target)}`);
1042 }
1043 if (isCollectionType(target)) {
1044 warn(`Vue 2 does not support reactive collection types such as Map or Set.`);
1045 }
1046 }
1047 }
1048}
1049function isReactive(value) {
1050 if (isReadonly(value)) {
1051 return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
1052 }
1053 return !!(value && value.__ob__);
1054}
1055function isShallow(value) {
1056 return !!(value && value.__v_isShallow);
1057}
1058function isReadonly(value) {
1059 return !!(value && value.__v_isReadonly);
1060}
1061function isProxy(value) {
1062 return isReactive(value) || isReadonly(value);
1063}
1064function toRaw(observed) {
1065 const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
1066 return raw ? toRaw(raw) : observed;
1067}
1068function markRaw(value) {
1069 // non-extensible objects won't be observed anyway
1070 if (Object.isExtensible(value)) {
1071 def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
1072 }
1073 return value;
1074}
1075/**
1076 * @internal
1077 */
1078function isCollectionType(value) {
1079 const type = toRawType(value);
1080 return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
1081}
1082
1083/**
1084 * @internal
1085 */
1086const RefFlag = `__v_isRef`;
1087function isRef(r) {
1088 return !!(r && r.__v_isRef === true);
1089}
1090function ref$1(value) {
1091 return createRef(value, false);
1092}
1093function shallowRef(value) {
1094 return createRef(value, true);
1095}
1096function createRef(rawValue, shallow) {
1097 if (isRef(rawValue)) {
1098 return rawValue;
1099 }
1100 const ref = {};
1101 def(ref, RefFlag, true);
1102 def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
1103 def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
1104 return ref;
1105}
1106function triggerRef(ref) {
1107 if (!ref.dep) {
1108 warn(`received object is not a triggerable ref.`);
1109 }
1110 {
1111 ref.dep &&
1112 ref.dep.notify({
1113 type: "set" /* TriggerOpTypes.SET */,
1114 target: ref,
1115 key: 'value'
1116 });
1117 }
1118}
1119function unref(ref) {
1120 return isRef(ref) ? ref.value : ref;
1121}
1122function proxyRefs(objectWithRefs) {
1123 if (isReactive(objectWithRefs)) {
1124 return objectWithRefs;
1125 }
1126 const proxy = {};
1127 const keys = Object.keys(objectWithRefs);
1128 for (let i = 0; i < keys.length; i++) {
1129 proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
1130 }
1131 return proxy;
1132}
1133function proxyWithRefUnwrap(target, source, key) {
1134 Object.defineProperty(target, key, {
1135 enumerable: true,
1136 configurable: true,
1137 get: () => {
1138 const val = source[key];
1139 if (isRef(val)) {
1140 return val.value;
1141 }
1142 else {
1143 const ob = val && val.__ob__;
1144 if (ob)
1145 ob.dep.depend();
1146 return val;
1147 }
1148 },
1149 set: value => {
1150 const oldValue = source[key];
1151 if (isRef(oldValue) && !isRef(value)) {
1152 oldValue.value = value;
1153 }
1154 else {
1155 source[key] = value;
1156 }
1157 }
1158 });
1159}
1160function customRef(factory) {
1161 const dep = new Dep();
1162 const { get, set } = factory(() => {
1163 {
1164 dep.depend({
1165 target: ref,
1166 type: "get" /* TrackOpTypes.GET */,
1167 key: 'value'
1168 });
1169 }
1170 }, () => {
1171 {
1172 dep.notify({
1173 target: ref,
1174 type: "set" /* TriggerOpTypes.SET */,
1175 key: 'value'
1176 });
1177 }
1178 });
1179 const ref = {
1180 get value() {
1181 return get();
1182 },
1183 set value(newVal) {
1184 set(newVal);
1185 }
1186 };
1187 def(ref, RefFlag, true);
1188 return ref;
1189}
1190function toRefs(object) {
1191 if (!isReactive(object)) {
1192 warn(`toRefs() expects a reactive object but received a plain one.`);
1193 }
1194 const ret = isArray(object) ? new Array(object.length) : {};
1195 for (const key in object) {
1196 ret[key] = toRef(object, key);
1197 }
1198 return ret;
1199}
1200function toRef(object, key, defaultValue) {
1201 const val = object[key];
1202 if (isRef(val)) {
1203 return val;
1204 }
1205 const ref = {
1206 get value() {
1207 const val = object[key];
1208 return val === undefined ? defaultValue : val;
1209 },
1210 set value(newVal) {
1211 object[key] = newVal;
1212 }
1213 };
1214 def(ref, RefFlag, true);
1215 return ref;
1216}
1217
1218const rawToReadonlyFlag = `__v_rawToReadonly`;
1219const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`;
1220function readonly(target) {
1221 return createReadonly(target, false);
1222}
1223function createReadonly(target, shallow) {
1224 if (!isPlainObject(target)) {
1225 {
1226 if (isArray(target)) {
1227 warn(`Vue 2 does not support readonly arrays.`);
1228 }
1229 else if (isCollectionType(target)) {
1230 warn(`Vue 2 does not support readonly collection types such as Map or Set.`);
1231 }
1232 else {
1233 warn(`value cannot be made readonly: ${typeof target}`);
1234 }
1235 }
1236 return target;
1237 }
1238 if (!Object.isExtensible(target)) {
1239 warn(`Vue 2 does not support creating readonly proxy for non-extensible object.`);
1240 }
1241 // already a readonly object
1242 if (isReadonly(target)) {
1243 return target;
1244 }
1245 // already has a readonly proxy
1246 const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
1247 const existingProxy = target[existingFlag];
1248 if (existingProxy) {
1249 return existingProxy;
1250 }
1251 const proxy = Object.create(Object.getPrototypeOf(target));
1252 def(target, existingFlag, proxy);
1253 def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
1254 def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
1255 if (isRef(target)) {
1256 def(proxy, RefFlag, true);
1257 }
1258 if (shallow || isShallow(target)) {
1259 def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
1260 }
1261 const keys = Object.keys(target);
1262 for (let i = 0; i < keys.length; i++) {
1263 defineReadonlyProperty(proxy, target, keys[i], shallow);
1264 }
1265 return proxy;
1266}
1267function defineReadonlyProperty(proxy, target, key, shallow) {
1268 Object.defineProperty(proxy, key, {
1269 enumerable: true,
1270 configurable: true,
1271 get() {
1272 const val = target[key];
1273 return shallow || !isPlainObject(val) ? val : readonly(val);
1274 },
1275 set() {
1276 warn(`Set operation on key "${key}" failed: target is readonly.`);
1277 }
1278 });
1279}
1280/**
1281 * Returns a reactive-copy of the original object, where only the root level
1282 * properties are readonly, and does NOT unwrap refs nor recursively convert
1283 * returned properties.
1284 * This is used for creating the props proxy object for stateful components.
1285 */
1286function shallowReadonly(target) {
1287 return createReadonly(target, true);
1288}
1289
1290function computed(getterOrOptions, debugOptions) {
1291 let getter;
1292 let setter;
1293 const onlyGetter = isFunction(getterOrOptions);
1294 if (onlyGetter) {
1295 getter = getterOrOptions;
1296 setter = () => {
1297 warn('Write operation failed: computed value is readonly');
1298 }
1299 ;
1300 }
1301 else {
1302 getter = getterOrOptions.get;
1303 setter = getterOrOptions.set;
1304 }
1305 const watcher = isServerRendering()
1306 ? null
1307 : new Watcher(currentInstance, getter, noop, { lazy: true });
1308 if (watcher && debugOptions) {
1309 watcher.onTrack = debugOptions.onTrack;
1310 watcher.onTrigger = debugOptions.onTrigger;
1311 }
1312 const ref = {
1313 // some libs rely on the presence effect for checking computed refs
1314 // from normal refs, but the implementation doesn't matter
1315 effect: watcher,
1316 get value() {
1317 if (watcher) {
1318 if (watcher.dirty) {
1319 watcher.evaluate();
1320 }
1321 if (Dep.target) {
1322 if (Dep.target.onTrack) {
1323 Dep.target.onTrack({
1324 effect: Dep.target,
1325 target: ref,
1326 type: "get" /* TrackOpTypes.GET */,
1327 key: 'value'
1328 });
1329 }
1330 watcher.depend();
1331 }
1332 return watcher.value;
1333 }
1334 else {
1335 return getter();
1336 }
1337 },
1338 set value(newVal) {
1339 setter(newVal);
1340 }
1341 };
1342 def(ref, RefFlag, true);
1343 def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
1344 return ref;
1345}
1346
1347const WATCHER = `watcher`;
1348const WATCHER_CB = `${WATCHER} callback`;
1349const WATCHER_GETTER = `${WATCHER} getter`;
1350const WATCHER_CLEANUP = `${WATCHER} cleanup`;
1351// Simple effect.
1352function watchEffect(effect, options) {
1353 return doWatch(effect, null, options);
1354}
1355function watchPostEffect(effect, options) {
1356 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
1357}
1358function watchSyncEffect(effect, options) {
1359 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
1360}
1361// initial value for watchers to trigger on undefined initial values
1362const INITIAL_WATCHER_VALUE = {};
1363// implementation
1364function watch(source, cb, options) {
1365 if (typeof cb !== 'function') {
1366 warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
1367 `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
1368 `supports \`watch(source, cb, options?) signature.`);
1369 }
1370 return doWatch(source, cb, options);
1371}
1372function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigger } = emptyObject) {
1373 if (!cb) {
1374 if (immediate !== undefined) {
1375 warn(`watch() "immediate" option is only respected when using the ` +
1376 `watch(source, callback, options?) signature.`);
1377 }
1378 if (deep !== undefined) {
1379 warn(`watch() "deep" option is only respected when using the ` +
1380 `watch(source, callback, options?) signature.`);
1381 }
1382 }
1383 const warnInvalidSource = (s) => {
1384 warn(`Invalid watch source: ${s}. A watch source can only be a getter/effect ` +
1385 `function, a ref, a reactive object, or an array of these types.`);
1386 };
1387 const instance = currentInstance;
1388 const call = (fn, type, args = null) => invokeWithErrorHandling(fn, null, args, instance, type);
1389 let getter;
1390 let forceTrigger = false;
1391 let isMultiSource = false;
1392 if (isRef(source)) {
1393 getter = () => source.value;
1394 forceTrigger = isShallow(source);
1395 }
1396 else if (isReactive(source)) {
1397 getter = () => {
1398 source.__ob__.dep.depend();
1399 return source;
1400 };
1401 deep = true;
1402 }
1403 else if (isArray(source)) {
1404 isMultiSource = true;
1405 forceTrigger = source.some(s => isReactive(s) || isShallow(s));
1406 getter = () => source.map(s => {
1407 if (isRef(s)) {
1408 return s.value;
1409 }
1410 else if (isReactive(s)) {
1411 return traverse(s);
1412 }
1413 else if (isFunction(s)) {
1414 return call(s, WATCHER_GETTER);
1415 }
1416 else {
1417 warnInvalidSource(s);
1418 }
1419 });
1420 }
1421 else if (isFunction(source)) {
1422 if (cb) {
1423 // getter with cb
1424 getter = () => call(source, WATCHER_GETTER);
1425 }
1426 else {
1427 // no cb -> simple effect
1428 getter = () => {
1429 if (instance && instance._isDestroyed) {
1430 return;
1431 }
1432 if (cleanup) {
1433 cleanup();
1434 }
1435 return call(source, WATCHER, [onCleanup]);
1436 };
1437 }
1438 }
1439 else {
1440 getter = noop;
1441 warnInvalidSource(source);
1442 }
1443 if (cb && deep) {
1444 const baseGetter = getter;
1445 getter = () => traverse(baseGetter());
1446 }
1447 let cleanup;
1448 let onCleanup = (fn) => {
1449 cleanup = watcher.onStop = () => {
1450 call(fn, WATCHER_CLEANUP);
1451 };
1452 };
1453 // in SSR there is no need to setup an actual effect, and it should be noop
1454 // unless it's eager
1455 if (isServerRendering()) {
1456 // we will also not call the invalidate callback (+ runner is not set up)
1457 onCleanup = noop;
1458 if (!cb) {
1459 getter();
1460 }
1461 else if (immediate) {
1462 call(cb, WATCHER_CB, [
1463 getter(),
1464 isMultiSource ? [] : undefined,
1465 onCleanup
1466 ]);
1467 }
1468 return noop;
1469 }
1470 const watcher = new Watcher(currentInstance, getter, noop, {
1471 lazy: true
1472 });
1473 watcher.noRecurse = !cb;
1474 let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
1475 // overwrite default run
1476 watcher.run = () => {
1477 if (!watcher.active) {
1478 return;
1479 }
1480 if (cb) {
1481 // watch(source, cb)
1482 const newValue = watcher.get();
1483 if (deep ||
1484 forceTrigger ||
1485 (isMultiSource
1486 ? newValue.some((v, i) => hasChanged(v, oldValue[i]))
1487 : hasChanged(newValue, oldValue))) {
1488 // cleanup before running cb again
1489 if (cleanup) {
1490 cleanup();
1491 }
1492 call(cb, WATCHER_CB, [
1493 newValue,
1494 // pass undefined as the old value when it's changed for the first time
1495 oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
1496 onCleanup
1497 ]);
1498 oldValue = newValue;
1499 }
1500 }
1501 else {
1502 // watchEffect
1503 watcher.get();
1504 }
1505 };
1506 if (flush === 'sync') {
1507 watcher.update = watcher.run;
1508 }
1509 else if (flush === 'post') {
1510 watcher.post = true;
1511 watcher.update = () => queueWatcher(watcher);
1512 }
1513 else {
1514 // pre
1515 watcher.update = () => {
1516 if (instance && instance === currentInstance && !instance._isMounted) {
1517 // pre-watcher triggered before
1518 const buffer = instance._preWatchers || (instance._preWatchers = []);
1519 if (buffer.indexOf(watcher) < 0)
1520 buffer.push(watcher);
1521 }
1522 else {
1523 queueWatcher(watcher);
1524 }
1525 };
1526 }
1527 {
1528 watcher.onTrack = onTrack;
1529 watcher.onTrigger = onTrigger;
1530 }
1531 // initial run
1532 if (cb) {
1533 if (immediate) {
1534 watcher.run();
1535 }
1536 else {
1537 oldValue = watcher.get();
1538 }
1539 }
1540 else if (flush === 'post' && instance) {
1541 instance.$once('hook:mounted', () => watcher.get());
1542 }
1543 else {
1544 watcher.get();
1545 }
1546 return () => {
1547 watcher.teardown();
1548 };
1549}
1550
1551let activeEffectScope;
1552class EffectScope {
1553 constructor(detached = false) {
1554 this.detached = detached;
1555 /**
1556 * @internal
1557 */
1558 this.active = true;
1559 /**
1560 * @internal
1561 */
1562 this.effects = [];
1563 /**
1564 * @internal
1565 */
1566 this.cleanups = [];
1567 this.parent = activeEffectScope;
1568 if (!detached && activeEffectScope) {
1569 this.index =
1570 (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
1571 }
1572 }
1573 run(fn) {
1574 if (this.active) {
1575 const currentEffectScope = activeEffectScope;
1576 try {
1577 activeEffectScope = this;
1578 return fn();
1579 }
1580 finally {
1581 activeEffectScope = currentEffectScope;
1582 }
1583 }
1584 else {
1585 warn(`cannot run an inactive effect scope.`);
1586 }
1587 }
1588 /**
1589 * This should only be called on non-detached scopes
1590 * @internal
1591 */
1592 on() {
1593 activeEffectScope = this;
1594 }
1595 /**
1596 * This should only be called on non-detached scopes
1597 * @internal
1598 */
1599 off() {
1600 activeEffectScope = this.parent;
1601 }
1602 stop(fromParent) {
1603 if (this.active) {
1604 let i, l;
1605 for (i = 0, l = this.effects.length; i < l; i++) {
1606 this.effects[i].teardown();
1607 }
1608 for (i = 0, l = this.cleanups.length; i < l; i++) {
1609 this.cleanups[i]();
1610 }
1611 if (this.scopes) {
1612 for (i = 0, l = this.scopes.length; i < l; i++) {
1613 this.scopes[i].stop(true);
1614 }
1615 }
1616 // nested scope, dereference from parent to avoid memory leaks
1617 if (!this.detached && this.parent && !fromParent) {
1618 // optimized O(1) removal
1619 const last = this.parent.scopes.pop();
1620 if (last && last !== this) {
1621 this.parent.scopes[this.index] = last;
1622 last.index = this.index;
1623 }
1624 }
1625 this.parent = undefined;
1626 this.active = false;
1627 }
1628 }
1629}
1630function effectScope(detached) {
1631 return new EffectScope(detached);
1632}
1633/**
1634 * @internal
1635 */
1636function recordEffectScope(effect, scope = activeEffectScope) {
1637 if (scope && scope.active) {
1638 scope.effects.push(effect);
1639 }
1640}
1641function getCurrentScope() {
1642 return activeEffectScope;
1643}
1644function onScopeDispose(fn) {
1645 if (activeEffectScope) {
1646 activeEffectScope.cleanups.push(fn);
1647 }
1648 else {
1649 warn(`onScopeDispose() is called when there is no active effect scope` +
1650 ` to be associated with.`);
1651 }
1652}
1653
1654function provide(key, value) {
1655 if (!currentInstance) {
1656 {
1657 warn(`provide() can only be used inside setup().`);
1658 }
1659 }
1660 else {
1661 // TS doesn't allow symbol as index type
1662 resolveProvided(currentInstance)[key] = value;
1663 }
1664}
1665function resolveProvided(vm) {
1666 // by default an instance inherits its parent's provides object
1667 // but when it needs to provide values of its own, it creates its
1668 // own provides object using parent provides object as prototype.
1669 // this way in `inject` we can simply look up injections from direct
1670 // parent and let the prototype chain do the work.
1671 const existing = vm._provided;
1672 const parentProvides = vm.$parent && vm.$parent._provided;
1673 if (parentProvides === existing) {
1674 return (vm._provided = Object.create(parentProvides));
1675 }
1676 else {
1677 return existing;
1678 }
1679}
1680function inject(key, defaultValue, treatDefaultAsFactory = false) {
1681 // fallback to `currentRenderingInstance` so that this can be called in
1682 // a functional component
1683 const instance = currentInstance;
1684 if (instance) {
1685 // #2400
1686 // to support `app.use` plugins,
1687 // fallback to appContext's `provides` if the instance is at root
1688 const provides = instance.$parent && instance.$parent._provided;
1689 if (provides && key in provides) {
1690 // TS doesn't allow symbol as index type
1691 return provides[key];
1692 }
1693 else if (arguments.length > 1) {
1694 return treatDefaultAsFactory && isFunction(defaultValue)
1695 ? defaultValue.call(instance)
1696 : defaultValue;
1697 }
1698 else {
1699 warn(`injection "${String(key)}" not found.`);
1700 }
1701 }
1702 else {
1703 warn(`inject() can only be used inside setup() or functional components.`);
1704 }
1705}
1706
1707const normalizeEvent = cached((name) => {
1708 const passive = name.charAt(0) === '&';
1709 name = passive ? name.slice(1) : name;
1710 const once = name.charAt(0) === '~'; // Prefixed last, checked first
1711 name = once ? name.slice(1) : name;
1712 const capture = name.charAt(0) === '!';
1713 name = capture ? name.slice(1) : name;
1714 return {
1715 name,
1716 once,
1717 capture,
1718 passive
1719 };
1720});
1721function createFnInvoker(fns, vm) {
1722 function invoker() {
1723 const fns = invoker.fns;
1724 if (isArray(fns)) {
1725 const cloned = fns.slice();
1726 for (let i = 0; i < cloned.length; i++) {
1727 invokeWithErrorHandling(cloned[i], null, arguments, vm, `v-on handler`);
1728 }
1729 }
1730 else {
1731 // return handler return value for single handlers
1732 return invokeWithErrorHandling(fns, null, arguments, vm, `v-on handler`);
1733 }
1734 }
1735 invoker.fns = fns;
1736 return invoker;
1737}
1738function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
1739 let name, cur, old, event;
1740 for (name in on) {
1741 cur = on[name];
1742 old = oldOn[name];
1743 event = normalizeEvent(name);
1744 if (isUndef(cur)) {
1745 warn(`Invalid handler for event "${event.name}": got ` + String(cur), vm);
1746 }
1747 else if (isUndef(old)) {
1748 if (isUndef(cur.fns)) {
1749 cur = on[name] = createFnInvoker(cur, vm);
1750 }
1751 if (isTrue(event.once)) {
1752 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
1753 }
1754 add(event.name, cur, event.capture, event.passive, event.params);
1755 }
1756 else if (cur !== old) {
1757 old.fns = cur;
1758 on[name] = old;
1759 }
1760 }
1761 for (name in oldOn) {
1762 if (isUndef(on[name])) {
1763 event = normalizeEvent(name);
1764 remove(event.name, oldOn[name], event.capture);
1765 }
1766 }
1767}
1768
1769function mergeVNodeHook(def, hookKey, hook) {
1770 if (def instanceof VNode) {
1771 def = def.data.hook || (def.data.hook = {});
1772 }
1773 let invoker;
1774 const oldHook = def[hookKey];
1775 function wrappedHook() {
1776 hook.apply(this, arguments);
1777 // important: remove merged hook to ensure it's called only once
1778 // and prevent memory leak
1779 remove$2(invoker.fns, wrappedHook);
1780 }
1781 if (isUndef(oldHook)) {
1782 // no existing hook
1783 invoker = createFnInvoker([wrappedHook]);
1784 }
1785 else {
1786 /* istanbul ignore if */
1787 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
1788 // already a merged invoker
1789 invoker = oldHook;
1790 invoker.fns.push(wrappedHook);
1791 }
1792 else {
1793 // existing plain hook
1794 invoker = createFnInvoker([oldHook, wrappedHook]);
1795 }
1796 }
1797 invoker.merged = true;
1798 def[hookKey] = invoker;
1799}
1800
1801function extractPropsFromVNodeData(data, Ctor, tag) {
1802 // we are only extracting raw values here.
1803 // validation and default values are handled in the child
1804 // component itself.
1805 const propOptions = Ctor.options.props;
1806 if (isUndef(propOptions)) {
1807 return;
1808 }
1809 const res = {};
1810 const { attrs, props } = data;
1811 if (isDef(attrs) || isDef(props)) {
1812 for (const key in propOptions) {
1813 const altKey = hyphenate(key);
1814 {
1815 const keyInLowerCase = key.toLowerCase();
1816 if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
1817 tip(`Prop "${keyInLowerCase}" is passed to component ` +
1818 `${formatComponentName(
1819 // @ts-expect-error tag is string
1820 tag || Ctor)}, but the declared prop name is` +
1821 ` "${key}". ` +
1822 `Note that HTML attributes are case-insensitive and camelCased ` +
1823 `props need to use their kebab-case equivalents when using in-DOM ` +
1824 `templates. You should probably use "${altKey}" instead of "${key}".`);
1825 }
1826 }
1827 checkProp(res, props, key, altKey, true) ||
1828 checkProp(res, attrs, key, altKey, false);
1829 }
1830 }
1831 return res;
1832}
1833function checkProp(res, hash, key, altKey, preserve) {
1834 if (isDef(hash)) {
1835 if (hasOwn(hash, key)) {
1836 res[key] = hash[key];
1837 if (!preserve) {
1838 delete hash[key];
1839 }
1840 return true;
1841 }
1842 else if (hasOwn(hash, altKey)) {
1843 res[key] = hash[altKey];
1844 if (!preserve) {
1845 delete hash[altKey];
1846 }
1847 return true;
1848 }
1849 }
1850 return false;
1851}
1852
1853// The template compiler attempts to minimize the need for normalization by
1854// statically analyzing the template at compile time.
1855//
1856// For plain HTML markup, normalization can be completely skipped because the
1857// generated render function is guaranteed to return Array<VNode>. There are
1858// two cases where extra normalization is needed:
1859// 1. When the children contains components - because a functional component
1860// may return an Array instead of a single root. In this case, just a simple
1861// normalization is needed - if any child is an Array, we flatten the whole
1862// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
1863// because functional components already normalize their own children.
1864function simpleNormalizeChildren(children) {
1865 for (let i = 0; i < children.length; i++) {
1866 if (isArray(children[i])) {
1867 return Array.prototype.concat.apply([], children);
1868 }
1869 }
1870 return children;
1871}
1872// 2. When the children contains constructs that always generated nested Arrays,
1873// e.g. <template>, <slot>, v-for, or when the children is provided by user
1874// with hand-written render functions / JSX. In such cases a full normalization
1875// is needed to cater to all possible types of children values.
1876function normalizeChildren(children) {
1877 return isPrimitive(children)
1878 ? [createTextVNode(children)]
1879 : isArray(children)
1880 ? normalizeArrayChildren(children)
1881 : undefined;
1882}
1883function isTextNode(node) {
1884 return isDef(node) && isDef(node.text) && isFalse(node.isComment);
1885}
1886function normalizeArrayChildren(children, nestedIndex) {
1887 const res = [];
1888 let i, c, lastIndex, last;
1889 for (i = 0; i < children.length; i++) {
1890 c = children[i];
1891 if (isUndef(c) || typeof c === 'boolean')
1892 continue;
1893 lastIndex = res.length - 1;
1894 last = res[lastIndex];
1895 // nested
1896 if (isArray(c)) {
1897 if (c.length > 0) {
1898 c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`);
1899 // merge adjacent text nodes
1900 if (isTextNode(c[0]) && isTextNode(last)) {
1901 res[lastIndex] = createTextVNode(last.text + c[0].text);
1902 c.shift();
1903 }
1904 res.push.apply(res, c);
1905 }
1906 }
1907 else if (isPrimitive(c)) {
1908 if (isTextNode(last)) {
1909 // merge adjacent text nodes
1910 // this is necessary for SSR hydration because text nodes are
1911 // essentially merged when rendered to HTML strings
1912 res[lastIndex] = createTextVNode(last.text + c);
1913 }
1914 else if (c !== '') {
1915 // convert primitive to vnode
1916 res.push(createTextVNode(c));
1917 }
1918 }
1919 else {
1920 if (isTextNode(c) && isTextNode(last)) {
1921 // merge adjacent text nodes
1922 res[lastIndex] = createTextVNode(last.text + c.text);
1923 }
1924 else {
1925 // default key for nested array children (likely generated by v-for)
1926 if (isTrue(children._isVList) &&
1927 isDef(c.tag) &&
1928 isUndef(c.key) &&
1929 isDef(nestedIndex)) {
1930 c.key = `__vlist${nestedIndex}_${i}__`;
1931 }
1932 res.push(c);
1933 }
1934 }
1935 }
1936 return res;
1937}
1938
1939/**
1940 * Runtime helper for rendering v-for lists.
1941 */
1942function renderList(val, render) {
1943 let ret = null, i, l, keys, key;
1944 if (isArray(val) || typeof val === 'string') {
1945 ret = new Array(val.length);
1946 for (i = 0, l = val.length; i < l; i++) {
1947 ret[i] = render(val[i], i);
1948 }
1949 }
1950 else if (typeof val === 'number') {
1951 ret = new Array(val);
1952 for (i = 0; i < val; i++) {
1953 ret[i] = render(i + 1, i);
1954 }
1955 }
1956 else if (isObject(val)) {
1957 if (hasSymbol && val[Symbol.iterator]) {
1958 ret = [];
1959 const iterator = val[Symbol.iterator]();
1960 let result = iterator.next();
1961 while (!result.done) {
1962 ret.push(render(result.value, ret.length));
1963 result = iterator.next();
1964 }
1965 }
1966 else {
1967 keys = Object.keys(val);
1968 ret = new Array(keys.length);
1969 for (i = 0, l = keys.length; i < l; i++) {
1970 key = keys[i];
1971 ret[i] = render(val[key], key, i);
1972 }
1973 }
1974 }
1975 if (!isDef(ret)) {
1976 ret = [];
1977 }
1978 ret._isVList = true;
1979 return ret;
1980}
1981
1982/**
1983 * Runtime helper for rendering <slot>
1984 */
1985function renderSlot(name, fallbackRender, props, bindObject) {
1986 const scopedSlotFn = this.$scopedSlots[name];
1987 let nodes;
1988 if (scopedSlotFn) {
1989 // scoped slot
1990 props = props || {};
1991 if (bindObject) {
1992 if (!isObject(bindObject)) {
1993 warn('slot v-bind without argument expects an Object', this);
1994 }
1995 props = extend(extend({}, bindObject), props);
1996 }
1997 nodes =
1998 scopedSlotFn(props) ||
1999 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
2000 }
2001 else {
2002 nodes =
2003 this.$slots[name] ||
2004 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
2005 }
2006 const target = props && props.slot;
2007 if (target) {
2008 return this.$createElement('template', { slot: target }, nodes);
2009 }
2010 else {
2011 return nodes;
2012 }
2013}
2014
2015/**
2016 * Runtime helper for resolving filters
2017 */
2018function resolveFilter(id) {
2019 return resolveAsset(this.$options, 'filters', id, true) || identity;
2020}
2021
2022function isKeyNotMatch(expect, actual) {
2023 if (isArray(expect)) {
2024 return expect.indexOf(actual) === -1;
2025 }
2026 else {
2027 return expect !== actual;
2028 }
2029}
2030/**
2031 * Runtime helper for checking keyCodes from config.
2032 * exposed as Vue.prototype._k
2033 * passing in eventKeyName as last argument separately for backwards compat
2034 */
2035function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
2036 const mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2037 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2038 return isKeyNotMatch(builtInKeyName, eventKeyName);
2039 }
2040 else if (mappedKeyCode) {
2041 return isKeyNotMatch(mappedKeyCode, eventKeyCode);
2042 }
2043 else if (eventKeyName) {
2044 return hyphenate(eventKeyName) !== key;
2045 }
2046 return eventKeyCode === undefined;
2047}
2048
2049/**
2050 * Runtime helper for merging v-bind="object" into a VNode's data.
2051 */
2052function bindObjectProps(data, tag, value, asProp, isSync) {
2053 if (value) {
2054 if (!isObject(value)) {
2055 warn('v-bind without argument expects an Object or Array value', this);
2056 }
2057 else {
2058 if (isArray(value)) {
2059 value = toObject(value);
2060 }
2061 let hash;
2062 for (const key in value) {
2063 if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
2064 hash = data;
2065 }
2066 else {
2067 const type = data.attrs && data.attrs.type;
2068 hash =
2069 asProp || config.mustUseProp(tag, type, key)
2070 ? data.domProps || (data.domProps = {})
2071 : data.attrs || (data.attrs = {});
2072 }
2073 const camelizedKey = camelize(key);
2074 const hyphenatedKey = hyphenate(key);
2075 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2076 hash[key] = value[key];
2077 if (isSync) {
2078 const on = data.on || (data.on = {});
2079 on[`update:${key}`] = function ($event) {
2080 value[key] = $event;
2081 };
2082 }
2083 }
2084 }
2085 }
2086 }
2087 return data;
2088}
2089
2090/**
2091 * Runtime helper for rendering static trees.
2092 */
2093function renderStatic(index, isInFor) {
2094 const cached = this._staticTrees || (this._staticTrees = []);
2095 let tree = cached[index];
2096 // if has already-rendered static tree and not inside v-for,
2097 // we can reuse the same tree.
2098 if (tree && !isInFor) {
2099 return tree;
2100 }
2101 // otherwise, render a fresh tree.
2102 tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
2103 );
2104 markStatic(tree, `__static__${index}`, false);
2105 return tree;
2106}
2107/**
2108 * Runtime helper for v-once.
2109 * Effectively it means marking the node as static with a unique key.
2110 */
2111function markOnce(tree, index, key) {
2112 markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true);
2113 return tree;
2114}
2115function markStatic(tree, key, isOnce) {
2116 if (isArray(tree)) {
2117 for (let i = 0; i < tree.length; i++) {
2118 if (tree[i] && typeof tree[i] !== 'string') {
2119 markStaticNode(tree[i], `${key}_${i}`, isOnce);
2120 }
2121 }
2122 }
2123 else {
2124 markStaticNode(tree, key, isOnce);
2125 }
2126}
2127function markStaticNode(node, key, isOnce) {
2128 node.isStatic = true;
2129 node.key = key;
2130 node.isOnce = isOnce;
2131}
2132
2133function bindObjectListeners(data, value) {
2134 if (value) {
2135 if (!isPlainObject(value)) {
2136 warn('v-on without argument expects an Object value', this);
2137 }
2138 else {
2139 const on = (data.on = data.on ? extend({}, data.on) : {});
2140 for (const key in value) {
2141 const existing = on[key];
2142 const ours = value[key];
2143 on[key] = existing ? [].concat(existing, ours) : ours;
2144 }
2145 }
2146 }
2147 return data;
2148}
2149
2150function resolveScopedSlots(fns, res,
2151// the following are added in 2.6
2152hasDynamicKeys, contentHashKey) {
2153 res = res || { $stable: !hasDynamicKeys };
2154 for (let i = 0; i < fns.length; i++) {
2155 const slot = fns[i];
2156 if (isArray(slot)) {
2157 resolveScopedSlots(slot, res, hasDynamicKeys);
2158 }
2159 else if (slot) {
2160 // marker for reverse proxying v-slot without scope on this.$slots
2161 // @ts-expect-error
2162 if (slot.proxy) {
2163 // @ts-expect-error
2164 slot.fn.proxy = true;
2165 }
2166 res[slot.key] = slot.fn;
2167 }
2168 }
2169 if (contentHashKey) {
2170 res.$key = contentHashKey;
2171 }
2172 return res;
2173}
2174
2175// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
2176function bindDynamicKeys(baseObj, values) {
2177 for (let i = 0; i < values.length; i += 2) {
2178 const key = values[i];
2179 if (typeof key === 'string' && key) {
2180 baseObj[values[i]] = values[i + 1];
2181 }
2182 else if (key !== '' && key !== null) {
2183 // null is a special value for explicitly removing a binding
2184 warn(`Invalid value for dynamic directive argument (expected string or null): ${key}`, this);
2185 }
2186 }
2187 return baseObj;
2188}
2189// helper to dynamically append modifier runtime markers to event names.
2190// ensure only append when value is already string, otherwise it will be cast
2191// to string and cause the type check to miss.
2192function prependModifier(value, symbol) {
2193 return typeof value === 'string' ? symbol + value : value;
2194}
2195
2196function installRenderHelpers(target) {
2197 target._o = markOnce;
2198 target._n = toNumber;
2199 target._s = toString;
2200 target._l = renderList;
2201 target._t = renderSlot;
2202 target._q = looseEqual;
2203 target._i = looseIndexOf;
2204 target._m = renderStatic;
2205 target._f = resolveFilter;
2206 target._k = checkKeyCodes;
2207 target._b = bindObjectProps;
2208 target._v = createTextVNode;
2209 target._e = createEmptyVNode;
2210 target._u = resolveScopedSlots;
2211 target._g = bindObjectListeners;
2212 target._d = bindDynamicKeys;
2213 target._p = prependModifier;
2214}
2215
2216/**
2217 * Runtime helper for resolving raw children VNodes into a slot object.
2218 */
2219function resolveSlots(children, context) {
2220 if (!children || !children.length) {
2221 return {};
2222 }
2223 const slots = {};
2224 for (let i = 0, l = children.length; i < l; i++) {
2225 const child = children[i];
2226 const data = child.data;
2227 // remove slot attribute if the node is resolved as a Vue slot node
2228 if (data && data.attrs && data.attrs.slot) {
2229 delete data.attrs.slot;
2230 }
2231 // named slots should only be respected if the vnode was rendered in the
2232 // same context.
2233 if ((child.context === context || child.fnContext === context) &&
2234 data &&
2235 data.slot != null) {
2236 const name = data.slot;
2237 const slot = slots[name] || (slots[name] = []);
2238 if (child.tag === 'template') {
2239 slot.push.apply(slot, child.children || []);
2240 }
2241 else {
2242 slot.push(child);
2243 }
2244 }
2245 else {
2246 (slots.default || (slots.default = [])).push(child);
2247 }
2248 }
2249 // ignore slots that contains only whitespace
2250 for (const name in slots) {
2251 if (slots[name].every(isWhitespace)) {
2252 delete slots[name];
2253 }
2254 }
2255 return slots;
2256}
2257function isWhitespace(node) {
2258 return (node.isComment && !node.asyncFactory) || node.text === ' ';
2259}
2260
2261function isAsyncPlaceholder(node) {
2262 // @ts-expect-error not really boolean type
2263 return node.isComment && node.asyncFactory;
2264}
2265
2266function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
2267 let res;
2268 const hasNormalSlots = Object.keys(normalSlots).length > 0;
2269 const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
2270 const key = scopedSlots && scopedSlots.$key;
2271 if (!scopedSlots) {
2272 res = {};
2273 }
2274 else if (scopedSlots._normalized) {
2275 // fast path 1: child component re-render only, parent did not change
2276 return scopedSlots._normalized;
2277 }
2278 else if (isStable &&
2279 prevScopedSlots &&
2280 prevScopedSlots !== emptyObject &&
2281 key === prevScopedSlots.$key &&
2282 !hasNormalSlots &&
2283 !prevScopedSlots.$hasNormal) {
2284 // fast path 2: stable scoped slots w/ no normal slots to proxy,
2285 // only need to normalize once
2286 return prevScopedSlots;
2287 }
2288 else {
2289 res = {};
2290 for (const key in scopedSlots) {
2291 if (scopedSlots[key] && key[0] !== '$') {
2292 res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]);
2293 }
2294 }
2295 }
2296 // expose normal slots on scopedSlots
2297 for (const key in normalSlots) {
2298 if (!(key in res)) {
2299 res[key] = proxyNormalSlot(normalSlots, key);
2300 }
2301 }
2302 // avoriaz seems to mock a non-extensible $scopedSlots object
2303 // and when that is passed down this would cause an error
2304 if (scopedSlots && Object.isExtensible(scopedSlots)) {
2305 scopedSlots._normalized = res;
2306 }
2307 def(res, '$stable', isStable);
2308 def(res, '$key', key);
2309 def(res, '$hasNormal', hasNormalSlots);
2310 return res;
2311}
2312function normalizeScopedSlot(vm, normalSlots, key, fn) {
2313 const normalized = function () {
2314 const cur = currentInstance;
2315 setCurrentInstance(vm);
2316 let res = arguments.length ? fn.apply(null, arguments) : fn({});
2317 res =
2318 res && typeof res === 'object' && !isArray(res)
2319 ? [res] // single vnode
2320 : normalizeChildren(res);
2321 const vnode = res && res[0];
2322 setCurrentInstance(cur);
2323 return res &&
2324 (!vnode ||
2325 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
2326 ? undefined
2327 : res;
2328 };
2329 // this is a slot using the new v-slot syntax without scope. although it is
2330 // compiled as a scoped slot, render fn users would expect it to be present
2331 // on this.$slots because the usage is semantically a normal slot.
2332 if (fn.proxy) {
2333 Object.defineProperty(normalSlots, key, {
2334 get: normalized,
2335 enumerable: true,
2336 configurable: true
2337 });
2338 }
2339 return normalized;
2340}
2341function proxyNormalSlot(slots, key) {
2342 return () => slots[key];
2343}
2344
2345function initSetup(vm) {
2346 const options = vm.$options;
2347 const setup = options.setup;
2348 if (setup) {
2349 const ctx = (vm._setupContext = createSetupContext(vm));
2350 setCurrentInstance(vm);
2351 pushTarget();
2352 const setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, `setup`);
2353 popTarget();
2354 setCurrentInstance();
2355 if (isFunction(setupResult)) {
2356 // render function
2357 // @ts-ignore
2358 options.render = setupResult;
2359 }
2360 else if (isObject(setupResult)) {
2361 // bindings
2362 if (setupResult instanceof VNode) {
2363 warn(`setup() should not return VNodes directly - ` +
2364 `return a render function instead.`);
2365 }
2366 vm._setupState = setupResult;
2367 // __sfc indicates compiled bindings from <script setup>
2368 if (!setupResult.__sfc) {
2369 for (const key in setupResult) {
2370 if (!isReserved(key)) {
2371 proxyWithRefUnwrap(vm, setupResult, key);
2372 }
2373 else {
2374 warn(`Avoid using variables that start with _ or $ in setup().`);
2375 }
2376 }
2377 }
2378 else {
2379 // exposed for compiled render fn
2380 const proxy = (vm._setupProxy = {});
2381 for (const key in setupResult) {
2382 if (key !== '__sfc') {
2383 proxyWithRefUnwrap(proxy, setupResult, key);
2384 }
2385 }
2386 }
2387 }
2388 else if (setupResult !== undefined) {
2389 warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`);
2390 }
2391 }
2392}
2393function createSetupContext(vm) {
2394 let exposeCalled = false;
2395 return {
2396 get attrs() {
2397 if (!vm._attrsProxy) {
2398 const proxy = (vm._attrsProxy = {});
2399 def(proxy, '_v_attr_proxy', true);
2400 syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
2401 }
2402 return vm._attrsProxy;
2403 },
2404 get listeners() {
2405 if (!vm._listenersProxy) {
2406 const proxy = (vm._listenersProxy = {});
2407 syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
2408 }
2409 return vm._listenersProxy;
2410 },
2411 get slots() {
2412 return initSlotsProxy(vm);
2413 },
2414 emit: bind(vm.$emit, vm),
2415 expose(exposed) {
2416 {
2417 if (exposeCalled) {
2418 warn(`expose() should be called only once per setup().`, vm);
2419 }
2420 exposeCalled = true;
2421 }
2422 if (exposed) {
2423 Object.keys(exposed).forEach(key => proxyWithRefUnwrap(vm, exposed, key));
2424 }
2425 }
2426 };
2427}
2428function syncSetupProxy(to, from, prev, instance, type) {
2429 let changed = false;
2430 for (const key in from) {
2431 if (!(key in to)) {
2432 changed = true;
2433 defineProxyAttr(to, key, instance, type);
2434 }
2435 else if (from[key] !== prev[key]) {
2436 changed = true;
2437 }
2438 }
2439 for (const key in to) {
2440 if (!(key in from)) {
2441 changed = true;
2442 delete to[key];
2443 }
2444 }
2445 return changed;
2446}
2447function defineProxyAttr(proxy, key, instance, type) {
2448 Object.defineProperty(proxy, key, {
2449 enumerable: true,
2450 configurable: true,
2451 get() {
2452 return instance[type][key];
2453 }
2454 });
2455}
2456function initSlotsProxy(vm) {
2457 if (!vm._slotsProxy) {
2458 syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
2459 }
2460 return vm._slotsProxy;
2461}
2462function syncSetupSlots(to, from) {
2463 for (const key in from) {
2464 to[key] = from[key];
2465 }
2466 for (const key in to) {
2467 if (!(key in from)) {
2468 delete to[key];
2469 }
2470 }
2471}
2472/**
2473 * @internal use manual type def because public setup context type relies on
2474 * legacy VNode types
2475 */
2476function useSlots() {
2477 return getContext().slots;
2478}
2479/**
2480 * @internal use manual type def because public setup context type relies on
2481 * legacy VNode types
2482 */
2483function useAttrs() {
2484 return getContext().attrs;
2485}
2486/**
2487 * Vue 2 only
2488 * @internal use manual type def because public setup context type relies on
2489 * legacy VNode types
2490 */
2491function useListeners() {
2492 return getContext().listeners;
2493}
2494function getContext() {
2495 if (!currentInstance) {
2496 warn(`useContext() called without active instance.`);
2497 }
2498 const vm = currentInstance;
2499 return vm._setupContext || (vm._setupContext = createSetupContext(vm));
2500}
2501/**
2502 * Runtime helper for merging default declarations. Imported by compiled code
2503 * only.
2504 * @internal
2505 */
2506function mergeDefaults(raw, defaults) {
2507 const props = isArray(raw)
2508 ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
2509 : raw;
2510 for (const key in defaults) {
2511 const opt = props[key];
2512 if (opt) {
2513 if (isArray(opt) || isFunction(opt)) {
2514 props[key] = { type: opt, default: defaults[key] };
2515 }
2516 else {
2517 opt.default = defaults[key];
2518 }
2519 }
2520 else if (opt === null) {
2521 props[key] = { default: defaults[key] };
2522 }
2523 else {
2524 warn(`props default key "${key}" has no corresponding declaration.`);
2525 }
2526 }
2527 return props;
2528}
2529
2530function initRender(vm) {
2531 vm._vnode = null; // the root of the child tree
2532 vm._staticTrees = null; // v-once cached trees
2533 const options = vm.$options;
2534 const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
2535 const renderContext = parentVnode && parentVnode.context;
2536 vm.$slots = resolveSlots(options._renderChildren, renderContext);
2537 vm.$scopedSlots = parentVnode
2538 ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
2539 : emptyObject;
2540 // bind the createElement fn to this instance
2541 // so that we get proper render context inside it.
2542 // args order: tag, data, children, normalizationType, alwaysNormalize
2543 // internal version is used by render functions compiled from templates
2544 // @ts-expect-error
2545 vm._c = (a, b, c, d) => createElement$1(vm, a, b, c, d, false);
2546 // normalization is always applied for the public version, used in
2547 // user-written render functions.
2548 // @ts-expect-error
2549 vm.$createElement = (a, b, c, d) => createElement$1(vm, a, b, c, d, true);
2550 // $attrs & $listeners are exposed for easier HOC creation.
2551 // they need to be reactive so that HOCs using them are always updated
2552 const parentData = parentVnode && parentVnode.data;
2553 /* istanbul ignore else */
2554 {
2555 defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, () => {
2556 !isUpdatingChildComponent && warn(`$attrs is readonly.`, vm);
2557 }, true);
2558 defineReactive(vm, '$listeners', options._parentListeners || emptyObject, () => {
2559 !isUpdatingChildComponent && warn(`$listeners is readonly.`, vm);
2560 }, true);
2561 }
2562}
2563let currentRenderingInstance = null;
2564function renderMixin(Vue) {
2565 // install runtime convenience helpers
2566 installRenderHelpers(Vue.prototype);
2567 Vue.prototype.$nextTick = function (fn) {
2568 return nextTick(fn, this);
2569 };
2570 Vue.prototype._render = function () {
2571 const vm = this;
2572 const { render, _parentVnode } = vm.$options;
2573 if (_parentVnode && vm._isMounted) {
2574 vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
2575 if (vm._slotsProxy) {
2576 syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
2577 }
2578 }
2579 // set parent vnode. this allows render functions to have access
2580 // to the data on the placeholder node.
2581 vm.$vnode = _parentVnode;
2582 // render self
2583 let vnode;
2584 try {
2585 // There's no need to maintain a stack because all render fns are called
2586 // separately from one another. Nested component's render fns are called
2587 // when parent component is patched.
2588 setCurrentInstance(vm);
2589 currentRenderingInstance = vm;
2590 vnode = render.call(vm._renderProxy, vm.$createElement);
2591 }
2592 catch (e) {
2593 handleError(e, vm, `render`);
2594 // return error render result,
2595 // or previous vnode to prevent render error causing blank component
2596 /* istanbul ignore else */
2597 if (vm.$options.renderError) {
2598 try {
2599 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
2600 }
2601 catch (e) {
2602 handleError(e, vm, `renderError`);
2603 vnode = vm._vnode;
2604 }
2605 }
2606 else {
2607 vnode = vm._vnode;
2608 }
2609 }
2610 finally {
2611 currentRenderingInstance = null;
2612 setCurrentInstance();
2613 }
2614 // if the returned array contains only a single node, allow it
2615 if (isArray(vnode) && vnode.length === 1) {
2616 vnode = vnode[0];
2617 }
2618 // return empty vnode in case the render function errored out
2619 if (!(vnode instanceof VNode)) {
2620 if (isArray(vnode)) {
2621 warn('Multiple root nodes returned from render function. Render function ' +
2622 'should return a single root node.', vm);
2623 }
2624 vnode = createEmptyVNode();
2625 }
2626 // set parent
2627 vnode.parent = _parentVnode;
2628 return vnode;
2629 };
2630}
2631
2632function ensureCtor(comp, base) {
2633 if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
2634 comp = comp.default;
2635 }
2636 return isObject(comp) ? base.extend(comp) : comp;
2637}
2638function createAsyncPlaceholder(factory, data, context, children, tag) {
2639 const node = createEmptyVNode();
2640 node.asyncFactory = factory;
2641 node.asyncMeta = { data, context, children, tag };
2642 return node;
2643}
2644function resolveAsyncComponent(factory, baseCtor) {
2645 if (isTrue(factory.error) && isDef(factory.errorComp)) {
2646 return factory.errorComp;
2647 }
2648 if (isDef(factory.resolved)) {
2649 return factory.resolved;
2650 }
2651 const owner = currentRenderingInstance;
2652 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
2653 // already pending
2654 factory.owners.push(owner);
2655 }
2656 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
2657 return factory.loadingComp;
2658 }
2659 if (owner && !isDef(factory.owners)) {
2660 const owners = (factory.owners = [owner]);
2661 let sync = true;
2662 let timerLoading = null;
2663 let timerTimeout = null;
2664 owner.$on('hook:destroyed', () => remove$2(owners, owner));
2665 const forceRender = (renderCompleted) => {
2666 for (let i = 0, l = owners.length; i < l; i++) {
2667 owners[i].$forceUpdate();
2668 }
2669 if (renderCompleted) {
2670 owners.length = 0;
2671 if (timerLoading !== null) {
2672 clearTimeout(timerLoading);
2673 timerLoading = null;
2674 }
2675 if (timerTimeout !== null) {
2676 clearTimeout(timerTimeout);
2677 timerTimeout = null;
2678 }
2679 }
2680 };
2681 const resolve = once((res) => {
2682 // cache resolved
2683 factory.resolved = ensureCtor(res, baseCtor);
2684 // invoke callbacks only if this is not a synchronous resolve
2685 // (async resolves are shimmed as synchronous during SSR)
2686 if (!sync) {
2687 forceRender(true);
2688 }
2689 else {
2690 owners.length = 0;
2691 }
2692 });
2693 const reject = once(reason => {
2694 warn(`Failed to resolve async component: ${String(factory)}` +
2695 (reason ? `\nReason: ${reason}` : ''));
2696 if (isDef(factory.errorComp)) {
2697 factory.error = true;
2698 forceRender(true);
2699 }
2700 });
2701 const res = factory(resolve, reject);
2702 if (isObject(res)) {
2703 if (isPromise(res)) {
2704 // () => Promise
2705 if (isUndef(factory.resolved)) {
2706 res.then(resolve, reject);
2707 }
2708 }
2709 else if (isPromise(res.component)) {
2710 res.component.then(resolve, reject);
2711 if (isDef(res.error)) {
2712 factory.errorComp = ensureCtor(res.error, baseCtor);
2713 }
2714 if (isDef(res.loading)) {
2715 factory.loadingComp = ensureCtor(res.loading, baseCtor);
2716 if (res.delay === 0) {
2717 factory.loading = true;
2718 }
2719 else {
2720 // @ts-expect-error NodeJS timeout type
2721 timerLoading = setTimeout(() => {
2722 timerLoading = null;
2723 if (isUndef(factory.resolved) && isUndef(factory.error)) {
2724 factory.loading = true;
2725 forceRender(false);
2726 }
2727 }, res.delay || 200);
2728 }
2729 }
2730 if (isDef(res.timeout)) {
2731 // @ts-expect-error NodeJS timeout type
2732 timerTimeout = setTimeout(() => {
2733 timerTimeout = null;
2734 if (isUndef(factory.resolved)) {
2735 reject(`timeout (${res.timeout}ms)` );
2736 }
2737 }, res.timeout);
2738 }
2739 }
2740 }
2741 sync = false;
2742 // return in case resolved synchronously
2743 return factory.loading ? factory.loadingComp : factory.resolved;
2744 }
2745}
2746
2747function getFirstComponentChild(children) {
2748 if (isArray(children)) {
2749 for (let i = 0; i < children.length; i++) {
2750 const c = children[i];
2751 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
2752 return c;
2753 }
2754 }
2755 }
2756}
2757
2758const SIMPLE_NORMALIZE = 1;
2759const ALWAYS_NORMALIZE = 2;
2760// wrapper function for providing a more flexible interface
2761// without getting yelled at by flow
2762function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
2763 if (isArray(data) || isPrimitive(data)) {
2764 normalizationType = children;
2765 children = data;
2766 data = undefined;
2767 }
2768 if (isTrue(alwaysNormalize)) {
2769 normalizationType = ALWAYS_NORMALIZE;
2770 }
2771 return _createElement(context, tag, data, children, normalizationType);
2772}
2773function _createElement(context, tag, data, children, normalizationType) {
2774 if (isDef(data) && isDef(data.__ob__)) {
2775 warn(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context);
2776 return createEmptyVNode();
2777 }
2778 // object syntax in v-bind
2779 if (isDef(data) && isDef(data.is)) {
2780 tag = data.is;
2781 }
2782 if (!tag) {
2783 // in case of component :is set to falsy value
2784 return createEmptyVNode();
2785 }
2786 // warn against non-primitive key
2787 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
2788 warn('Avoid using non-primitive value as key, ' +
2789 'use string/number value instead.', context);
2790 }
2791 // support single function children as default scoped slot
2792 if (isArray(children) && isFunction(children[0])) {
2793 data = data || {};
2794 data.scopedSlots = { default: children[0] };
2795 children.length = 0;
2796 }
2797 if (normalizationType === ALWAYS_NORMALIZE) {
2798 children = normalizeChildren(children);
2799 }
2800 else if (normalizationType === SIMPLE_NORMALIZE) {
2801 children = simpleNormalizeChildren(children);
2802 }
2803 let vnode, ns;
2804 if (typeof tag === 'string') {
2805 let Ctor;
2806 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
2807 if (config.isReservedTag(tag)) {
2808 // platform built-in elements
2809 if (isDef(data) &&
2810 isDef(data.nativeOn) &&
2811 data.tag !== 'component') {
2812 warn(`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`, context);
2813 }
2814 vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
2815 }
2816 else if ((!data || !data.pre) &&
2817 isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
2818 // component
2819 vnode = createComponent(Ctor, data, context, children, tag);
2820 }
2821 else {
2822 // unknown or unlisted namespaced elements
2823 // check at runtime because it may get assigned a namespace when its
2824 // parent normalizes children
2825 vnode = new VNode(tag, data, children, undefined, undefined, context);
2826 }
2827 }
2828 else {
2829 // direct component options / constructor
2830 vnode = createComponent(tag, data, context, children);
2831 }
2832 if (isArray(vnode)) {
2833 return vnode;
2834 }
2835 else if (isDef(vnode)) {
2836 if (isDef(ns))
2837 applyNS(vnode, ns);
2838 if (isDef(data))
2839 registerDeepBindings(data);
2840 return vnode;
2841 }
2842 else {
2843 return createEmptyVNode();
2844 }
2845}
2846function applyNS(vnode, ns, force) {
2847 vnode.ns = ns;
2848 if (vnode.tag === 'foreignObject') {
2849 // use default namespace inside foreignObject
2850 ns = undefined;
2851 force = true;
2852 }
2853 if (isDef(vnode.children)) {
2854 for (let i = 0, l = vnode.children.length; i < l; i++) {
2855 const child = vnode.children[i];
2856 if (isDef(child.tag) &&
2857 (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
2858 applyNS(child, ns, force);
2859 }
2860 }
2861 }
2862}
2863// ref #5318
2864// necessary to ensure parent re-render when deep bindings like :style and
2865// :class are used on slot nodes
2866function registerDeepBindings(data) {
2867 if (isObject(data.style)) {
2868 traverse(data.style);
2869 }
2870 if (isObject(data.class)) {
2871 traverse(data.class);
2872 }
2873}
2874
2875/**
2876 * @internal this function needs manual public type declaration because it relies
2877 * on previously manually authored types from Vue 2
2878 */
2879function h(type, props, children) {
2880 if (!currentInstance) {
2881 warn(`globally imported h() can only be invoked when there is an active ` +
2882 `component instance, e.g. synchronously in a component's render or setup function.`);
2883 }
2884 return createElement$1(currentInstance, type, props, children, 2, true);
2885}
2886
2887function handleError(err, vm, info) {
2888 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
2889 // See: https://github.com/vuejs/vuex/issues/1505
2890 pushTarget();
2891 try {
2892 if (vm) {
2893 let cur = vm;
2894 while ((cur = cur.$parent)) {
2895 const hooks = cur.$options.errorCaptured;
2896 if (hooks) {
2897 for (let i = 0; i < hooks.length; i++) {
2898 try {
2899 const capture = hooks[i].call(cur, err, vm, info) === false;
2900 if (capture)
2901 return;
2902 }
2903 catch (e) {
2904 globalHandleError(e, cur, 'errorCaptured hook');
2905 }
2906 }
2907 }
2908 }
2909 }
2910 globalHandleError(err, vm, info);
2911 }
2912 finally {
2913 popTarget();
2914 }
2915}
2916function invokeWithErrorHandling(handler, context, args, vm, info) {
2917 let res;
2918 try {
2919 res = args ? handler.apply(context, args) : handler.call(context);
2920 if (res && !res._isVue && isPromise(res) && !res._handled) {
2921 res.catch(e => handleError(e, vm, info + ` (Promise/async)`));
2922 res._handled = true;
2923 }
2924 }
2925 catch (e) {
2926 handleError(e, vm, info);
2927 }
2928 return res;
2929}
2930function globalHandleError(err, vm, info) {
2931 if (config.errorHandler) {
2932 try {
2933 return config.errorHandler.call(null, err, vm, info);
2934 }
2935 catch (e) {
2936 // if the user intentionally throws the original error in the handler,
2937 // do not log it twice
2938 if (e !== err) {
2939 logError(e, null, 'config.errorHandler');
2940 }
2941 }
2942 }
2943 logError(err, vm, info);
2944}
2945function logError(err, vm, info) {
2946 {
2947 warn(`Error in ${info}: "${err.toString()}"`, vm);
2948 }
2949 /* istanbul ignore else */
2950 if (inBrowser && typeof console !== 'undefined') {
2951 console.error(err);
2952 }
2953 else {
2954 throw err;
2955 }
2956}
2957
2958/* globals MutationObserver */
2959let isUsingMicroTask = false;
2960const callbacks = [];
2961let pending = false;
2962function flushCallbacks() {
2963 pending = false;
2964 const copies = callbacks.slice(0);
2965 callbacks.length = 0;
2966 for (let i = 0; i < copies.length; i++) {
2967 copies[i]();
2968 }
2969}
2970// Here we have async deferring wrappers using microtasks.
2971// In 2.5 we used (macro) tasks (in combination with microtasks).
2972// However, it has subtle problems when state is changed right before repaint
2973// (e.g. #6813, out-in transitions).
2974// Also, using (macro) tasks in event handler would cause some weird behaviors
2975// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
2976// So we now use microtasks everywhere, again.
2977// A major drawback of this tradeoff is that there are some scenarios
2978// where microtasks have too high a priority and fire in between supposedly
2979// sequential events (e.g. #4521, #6690, which have workarounds)
2980// or even between bubbling of the same event (#6566).
2981let timerFunc;
2982// The nextTick behavior leverages the microtask queue, which can be accessed
2983// via either native Promise.then or MutationObserver.
2984// MutationObserver has wider support, however it is seriously bugged in
2985// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
2986// completely stops working after triggering a few times... so, if native
2987// Promise is available, we will use it:
2988/* istanbul ignore next, $flow-disable-line */
2989if (typeof Promise !== 'undefined' && isNative(Promise)) {
2990 const p = Promise.resolve();
2991 timerFunc = () => {
2992 p.then(flushCallbacks);
2993 // In problematic UIWebViews, Promise.then doesn't completely break, but
2994 // it can get stuck in a weird state where callbacks are pushed into the
2995 // microtask queue but the queue isn't being flushed, until the browser
2996 // needs to do some other work, e.g. handle a timer. Therefore we can
2997 // "force" the microtask queue to be flushed by adding an empty timer.
2998 if (isIOS)
2999 setTimeout(noop);
3000 };
3001 isUsingMicroTask = true;
3002}
3003else if (!isIE &&
3004 typeof MutationObserver !== 'undefined' &&
3005 (isNative(MutationObserver) ||
3006 // PhantomJS and iOS 7.x
3007 MutationObserver.toString() === '[object MutationObserverConstructor]')) {
3008 // Use MutationObserver where native Promise is not available,
3009 // e.g. PhantomJS, iOS7, Android 4.4
3010 // (#6466 MutationObserver is unreliable in IE11)
3011 let counter = 1;
3012 const observer = new MutationObserver(flushCallbacks);
3013 const textNode = document.createTextNode(String(counter));
3014 observer.observe(textNode, {
3015 characterData: true
3016 });
3017 timerFunc = () => {
3018 counter = (counter + 1) % 2;
3019 textNode.data = String(counter);
3020 };
3021 isUsingMicroTask = true;
3022}
3023else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
3024 // Fallback to setImmediate.
3025 // Technically it leverages the (macro) task queue,
3026 // but it is still a better choice than setTimeout.
3027 timerFunc = () => {
3028 setImmediate(flushCallbacks);
3029 };
3030}
3031else {
3032 // Fallback to setTimeout.
3033 timerFunc = () => {
3034 setTimeout(flushCallbacks, 0);
3035 };
3036}
3037/**
3038 * @internal
3039 */
3040function nextTick(cb, ctx) {
3041 let _resolve;
3042 callbacks.push(() => {
3043 if (cb) {
3044 try {
3045 cb.call(ctx);
3046 }
3047 catch (e) {
3048 handleError(e, ctx, 'nextTick');
3049 }
3050 }
3051 else if (_resolve) {
3052 _resolve(ctx);
3053 }
3054 });
3055 if (!pending) {
3056 pending = true;
3057 timerFunc();
3058 }
3059 // $flow-disable-line
3060 if (!cb && typeof Promise !== 'undefined') {
3061 return new Promise(resolve => {
3062 _resolve = resolve;
3063 });
3064 }
3065}
3066
3067function useCssModule(name = '$style') {
3068 /* istanbul ignore else */
3069 {
3070 if (!currentInstance) {
3071 warn(`useCssModule must be called inside setup()`);
3072 return emptyObject;
3073 }
3074 const mod = currentInstance[name];
3075 if (!mod) {
3076 warn(`Current instance does not have CSS module named "${name}".`);
3077 return emptyObject;
3078 }
3079 return mod;
3080 }
3081}
3082
3083/**
3084 * Runtime helper for SFC's CSS variable injection feature.
3085 * @private
3086 */
3087function useCssVars(getter) {
3088 if (!inBrowser && !false)
3089 return;
3090 const instance = currentInstance;
3091 if (!instance) {
3092 warn(`useCssVars is called without current active component instance.`);
3093 return;
3094 }
3095 watchPostEffect(() => {
3096 const el = instance.$el;
3097 const vars = getter(instance, instance._setupProxy);
3098 if (el && el.nodeType === 1) {
3099 const style = el.style;
3100 for (const key in vars) {
3101 style.setProperty(`--${key}`, vars[key]);
3102 }
3103 }
3104 });
3105}
3106
3107/**
3108 * v3-compatible async component API.
3109 * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
3110 * because it relies on existing manual types
3111 */
3112function defineAsyncComponent(source) {
3113 if (isFunction(source)) {
3114 source = { loader: source };
3115 }
3116 const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
3117 suspensible = false, // in Vue 3 default is true
3118 onError: userOnError } = source;
3119 if (suspensible) {
3120 warn(`The suspensible option for async components is not supported in Vue2. It is ignored.`);
3121 }
3122 let pendingRequest = null;
3123 let retries = 0;
3124 const retry = () => {
3125 retries++;
3126 pendingRequest = null;
3127 return load();
3128 };
3129 const load = () => {
3130 let thisRequest;
3131 return (pendingRequest ||
3132 (thisRequest = pendingRequest =
3133 loader()
3134 .catch(err => {
3135 err = err instanceof Error ? err : new Error(String(err));
3136 if (userOnError) {
3137 return new Promise((resolve, reject) => {
3138 const userRetry = () => resolve(retry());
3139 const userFail = () => reject(err);
3140 userOnError(err, userRetry, userFail, retries + 1);
3141 });
3142 }
3143 else {
3144 throw err;
3145 }
3146 })
3147 .then((comp) => {
3148 if (thisRequest !== pendingRequest && pendingRequest) {
3149 return pendingRequest;
3150 }
3151 if (!comp) {
3152 warn(`Async component loader resolved to undefined. ` +
3153 `If you are using retry(), make sure to return its return value.`);
3154 }
3155 // interop module default
3156 if (comp &&
3157 (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
3158 comp = comp.default;
3159 }
3160 if (comp && !isObject(comp) && !isFunction(comp)) {
3161 throw new Error(`Invalid async component load result: ${comp}`);
3162 }
3163 return comp;
3164 })));
3165 };
3166 return () => {
3167 const component = load();
3168 return {
3169 component,
3170 delay,
3171 timeout,
3172 error: errorComponent,
3173 loading: loadingComponent
3174 };
3175 };
3176}
3177
3178function createLifeCycle(hookName) {
3179 return (fn, target = currentInstance) => {
3180 if (!target) {
3181 warn(`${formatName(hookName)} is called when there is no active component instance to be ` +
3182 `associated with. ` +
3183 `Lifecycle injection APIs can only be used during execution of setup().`);
3184 return;
3185 }
3186 return injectHook(target, hookName, fn);
3187 };
3188}
3189function formatName(name) {
3190 if (name === 'beforeDestroy') {
3191 name = 'beforeUnmount';
3192 }
3193 else if (name === 'destroyed') {
3194 name = 'unmounted';
3195 }
3196 return `on${name[0].toUpperCase() + name.slice(1)}`;
3197}
3198function injectHook(instance, hookName, fn) {
3199 const options = instance.$options;
3200 options[hookName] = mergeLifecycleHook(options[hookName], fn);
3201}
3202const onBeforeMount = createLifeCycle('beforeMount');
3203const onMounted = createLifeCycle('mounted');
3204const onBeforeUpdate = createLifeCycle('beforeUpdate');
3205const onUpdated = createLifeCycle('updated');
3206const onBeforeUnmount = createLifeCycle('beforeDestroy');
3207const onUnmounted = createLifeCycle('destroyed');
3208const onActivated = createLifeCycle('activated');
3209const onDeactivated = createLifeCycle('deactivated');
3210const onServerPrefetch = createLifeCycle('serverPrefetch');
3211const onRenderTracked = createLifeCycle('renderTracked');
3212const onRenderTriggered = createLifeCycle('renderTriggered');
3213const injectErrorCapturedHook = createLifeCycle('errorCaptured');
3214function onErrorCaptured(hook, target = currentInstance) {
3215 injectErrorCapturedHook(hook, target);
3216}
3217
3218/**
3219 * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3220 */
3221const version = '2.7.15';
3222/**
3223 * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3224 */
3225function defineComponent(options) {
3226 return options;
3227}
3228
3229var vca = /*#__PURE__*/Object.freeze({
3230 __proto__: null,
3231 version: version,
3232 defineComponent: defineComponent,
3233 ref: ref$1,
3234 shallowRef: shallowRef,
3235 isRef: isRef,
3236 toRef: toRef,
3237 toRefs: toRefs,
3238 unref: unref,
3239 proxyRefs: proxyRefs,
3240 customRef: customRef,
3241 triggerRef: triggerRef,
3242 reactive: reactive,
3243 isReactive: isReactive,
3244 isReadonly: isReadonly,
3245 isShallow: isShallow,
3246 isProxy: isProxy,
3247 shallowReactive: shallowReactive,
3248 markRaw: markRaw,
3249 toRaw: toRaw,
3250 readonly: readonly,
3251 shallowReadonly: shallowReadonly,
3252 computed: computed,
3253 watch: watch,
3254 watchEffect: watchEffect,
3255 watchPostEffect: watchPostEffect,
3256 watchSyncEffect: watchSyncEffect,
3257 EffectScope: EffectScope,
3258 effectScope: effectScope,
3259 onScopeDispose: onScopeDispose,
3260 getCurrentScope: getCurrentScope,
3261 provide: provide,
3262 inject: inject,
3263 h: h,
3264 getCurrentInstance: getCurrentInstance,
3265 useSlots: useSlots,
3266 useAttrs: useAttrs,
3267 useListeners: useListeners,
3268 mergeDefaults: mergeDefaults,
3269 nextTick: nextTick,
3270 set: set,
3271 del: del,
3272 useCssModule: useCssModule,
3273 useCssVars: useCssVars,
3274 defineAsyncComponent: defineAsyncComponent,
3275 onBeforeMount: onBeforeMount,
3276 onMounted: onMounted,
3277 onBeforeUpdate: onBeforeUpdate,
3278 onUpdated: onUpdated,
3279 onBeforeUnmount: onBeforeUnmount,
3280 onUnmounted: onUnmounted,
3281 onActivated: onActivated,
3282 onDeactivated: onDeactivated,
3283 onServerPrefetch: onServerPrefetch,
3284 onRenderTracked: onRenderTracked,
3285 onRenderTriggered: onRenderTriggered,
3286 onErrorCaptured: onErrorCaptured
3287});
3288
3289const seenObjects = new _Set();
3290/**
3291 * Recursively traverse an object to evoke all converted
3292 * getters, so that every nested property inside the object
3293 * is collected as a "deep" dependency.
3294 */
3295function traverse(val) {
3296 _traverse(val, seenObjects);
3297 seenObjects.clear();
3298 return val;
3299}
3300function _traverse(val, seen) {
3301 let i, keys;
3302 const isA = isArray(val);
3303 if ((!isA && !isObject(val)) ||
3304 val.__v_skip /* ReactiveFlags.SKIP */ ||
3305 Object.isFrozen(val) ||
3306 val instanceof VNode) {
3307 return;
3308 }
3309 if (val.__ob__) {
3310 const depId = val.__ob__.dep.id;
3311 if (seen.has(depId)) {
3312 return;
3313 }
3314 seen.add(depId);
3315 }
3316 if (isA) {
3317 i = val.length;
3318 while (i--)
3319 _traverse(val[i], seen);
3320 }
3321 else if (isRef(val)) {
3322 _traverse(val.value, seen);
3323 }
3324 else {
3325 keys = Object.keys(val);
3326 i = keys.length;
3327 while (i--)
3328 _traverse(val[keys[i]], seen);
3329 }
3330}
3331
3332let uid$1 = 0;
3333/**
3334 * A watcher parses an expression, collects dependencies,
3335 * and fires callback when the expression value changes.
3336 * This is used for both the $watch() api and directives.
3337 * @internal
3338 */
3339class Watcher {
3340 constructor(vm, expOrFn, cb, options, isRenderWatcher) {
3341 recordEffectScope(this,
3342 // if the active effect scope is manually created (not a component scope),
3343 // prioritize it
3344 activeEffectScope && !activeEffectScope._vm
3345 ? activeEffectScope
3346 : vm
3347 ? vm._scope
3348 : undefined);
3349 if ((this.vm = vm) && isRenderWatcher) {
3350 vm._watcher = this;
3351 }
3352 // options
3353 if (options) {
3354 this.deep = !!options.deep;
3355 this.user = !!options.user;
3356 this.lazy = !!options.lazy;
3357 this.sync = !!options.sync;
3358 this.before = options.before;
3359 {
3360 this.onTrack = options.onTrack;
3361 this.onTrigger = options.onTrigger;
3362 }
3363 }
3364 else {
3365 this.deep = this.user = this.lazy = this.sync = false;
3366 }
3367 this.cb = cb;
3368 this.id = ++uid$1; // uid for batching
3369 this.active = true;
3370 this.post = false;
3371 this.dirty = this.lazy; // for lazy watchers
3372 this.deps = [];
3373 this.newDeps = [];
3374 this.depIds = new _Set();
3375 this.newDepIds = new _Set();
3376 this.expression = expOrFn.toString() ;
3377 // parse expression for getter
3378 if (isFunction(expOrFn)) {
3379 this.getter = expOrFn;
3380 }
3381 else {
3382 this.getter = parsePath(expOrFn);
3383 if (!this.getter) {
3384 this.getter = noop;
3385 warn(`Failed watching path: "${expOrFn}" ` +
3386 'Watcher only accepts simple dot-delimited paths. ' +
3387 'For full control, use a function instead.', vm);
3388 }
3389 }
3390 this.value = this.lazy ? undefined : this.get();
3391 }
3392 /**
3393 * Evaluate the getter, and re-collect dependencies.
3394 */
3395 get() {
3396 pushTarget(this);
3397 let value;
3398 const vm = this.vm;
3399 try {
3400 value = this.getter.call(vm, vm);
3401 }
3402 catch (e) {
3403 if (this.user) {
3404 handleError(e, vm, `getter for watcher "${this.expression}"`);
3405 }
3406 else {
3407 throw e;
3408 }
3409 }
3410 finally {
3411 // "touch" every property so they are all tracked as
3412 // dependencies for deep watching
3413 if (this.deep) {
3414 traverse(value);
3415 }
3416 popTarget();
3417 this.cleanupDeps();
3418 }
3419 return value;
3420 }
3421 /**
3422 * Add a dependency to this directive.
3423 */
3424 addDep(dep) {
3425 const id = dep.id;
3426 if (!this.newDepIds.has(id)) {
3427 this.newDepIds.add(id);
3428 this.newDeps.push(dep);
3429 if (!this.depIds.has(id)) {
3430 dep.addSub(this);
3431 }
3432 }
3433 }
3434 /**
3435 * Clean up for dependency collection.
3436 */
3437 cleanupDeps() {
3438 let i = this.deps.length;
3439 while (i--) {
3440 const dep = this.deps[i];
3441 if (!this.newDepIds.has(dep.id)) {
3442 dep.removeSub(this);
3443 }
3444 }
3445 let tmp = this.depIds;
3446 this.depIds = this.newDepIds;
3447 this.newDepIds = tmp;
3448 this.newDepIds.clear();
3449 tmp = this.deps;
3450 this.deps = this.newDeps;
3451 this.newDeps = tmp;
3452 this.newDeps.length = 0;
3453 }
3454 /**
3455 * Subscriber interface.
3456 * Will be called when a dependency changes.
3457 */
3458 update() {
3459 /* istanbul ignore else */
3460 if (this.lazy) {
3461 this.dirty = true;
3462 }
3463 else if (this.sync) {
3464 this.run();
3465 }
3466 else {
3467 queueWatcher(this);
3468 }
3469 }
3470 /**
3471 * Scheduler job interface.
3472 * Will be called by the scheduler.
3473 */
3474 run() {
3475 if (this.active) {
3476 const value = this.get();
3477 if (value !== this.value ||
3478 // Deep watchers and watchers on Object/Arrays should fire even
3479 // when the value is the same, because the value may
3480 // have mutated.
3481 isObject(value) ||
3482 this.deep) {
3483 // set new value
3484 const oldValue = this.value;
3485 this.value = value;
3486 if (this.user) {
3487 const info = `callback for watcher "${this.expression}"`;
3488 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
3489 }
3490 else {
3491 this.cb.call(this.vm, value, oldValue);
3492 }
3493 }
3494 }
3495 }
3496 /**
3497 * Evaluate the value of the watcher.
3498 * This only gets called for lazy watchers.
3499 */
3500 evaluate() {
3501 this.value = this.get();
3502 this.dirty = false;
3503 }
3504 /**
3505 * Depend on all deps collected by this watcher.
3506 */
3507 depend() {
3508 let i = this.deps.length;
3509 while (i--) {
3510 this.deps[i].depend();
3511 }
3512 }
3513 /**
3514 * Remove self from all dependencies' subscriber list.
3515 */
3516 teardown() {
3517 if (this.vm && !this.vm._isBeingDestroyed) {
3518 remove$2(this.vm._scope.effects, this);
3519 }
3520 if (this.active) {
3521 let i = this.deps.length;
3522 while (i--) {
3523 this.deps[i].removeSub(this);
3524 }
3525 this.active = false;
3526 if (this.onStop) {
3527 this.onStop();
3528 }
3529 }
3530 }
3531}
3532
3533let mark;
3534let measure;
3535{
3536 const perf = inBrowser && window.performance;
3537 /* istanbul ignore if */
3538 if (perf &&
3539 // @ts-ignore
3540 perf.mark &&
3541 // @ts-ignore
3542 perf.measure &&
3543 // @ts-ignore
3544 perf.clearMarks &&
3545 // @ts-ignore
3546 perf.clearMeasures) {
3547 mark = tag => perf.mark(tag);
3548 measure = (name, startTag, endTag) => {
3549 perf.measure(name, startTag, endTag);
3550 perf.clearMarks(startTag);
3551 perf.clearMarks(endTag);
3552 // perf.clearMeasures(name)
3553 };
3554 }
3555}
3556
3557function initEvents(vm) {
3558 vm._events = Object.create(null);
3559 vm._hasHookEvent = false;
3560 // init parent attached events
3561 const listeners = vm.$options._parentListeners;
3562 if (listeners) {
3563 updateComponentListeners(vm, listeners);
3564 }
3565}
3566let target$1;
3567function add$1(event, fn) {
3568 target$1.$on(event, fn);
3569}
3570function remove$1(event, fn) {
3571 target$1.$off(event, fn);
3572}
3573function createOnceHandler$1(event, fn) {
3574 const _target = target$1;
3575 return function onceHandler() {
3576 const res = fn.apply(null, arguments);
3577 if (res !== null) {
3578 _target.$off(event, onceHandler);
3579 }
3580 };
3581}
3582function updateComponentListeners(vm, listeners, oldListeners) {
3583 target$1 = vm;
3584 updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
3585 target$1 = undefined;
3586}
3587function eventsMixin(Vue) {
3588 const hookRE = /^hook:/;
3589 Vue.prototype.$on = function (event, fn) {
3590 const vm = this;
3591 if (isArray(event)) {
3592 for (let i = 0, l = event.length; i < l; i++) {
3593 vm.$on(event[i], fn);
3594 }
3595 }
3596 else {
3597 (vm._events[event] || (vm._events[event] = [])).push(fn);
3598 // optimize hook:event cost by using a boolean flag marked at registration
3599 // instead of a hash lookup
3600 if (hookRE.test(event)) {
3601 vm._hasHookEvent = true;
3602 }
3603 }
3604 return vm;
3605 };
3606 Vue.prototype.$once = function (event, fn) {
3607 const vm = this;
3608 function on() {
3609 vm.$off(event, on);
3610 fn.apply(vm, arguments);
3611 }
3612 on.fn = fn;
3613 vm.$on(event, on);
3614 return vm;
3615 };
3616 Vue.prototype.$off = function (event, fn) {
3617 const vm = this;
3618 // all
3619 if (!arguments.length) {
3620 vm._events = Object.create(null);
3621 return vm;
3622 }
3623 // array of events
3624 if (isArray(event)) {
3625 for (let i = 0, l = event.length; i < l; i++) {
3626 vm.$off(event[i], fn);
3627 }
3628 return vm;
3629 }
3630 // specific event
3631 const cbs = vm._events[event];
3632 if (!cbs) {
3633 return vm;
3634 }
3635 if (!fn) {
3636 vm._events[event] = null;
3637 return vm;
3638 }
3639 // specific handler
3640 let cb;
3641 let i = cbs.length;
3642 while (i--) {
3643 cb = cbs[i];
3644 if (cb === fn || cb.fn === fn) {
3645 cbs.splice(i, 1);
3646 break;
3647 }
3648 }
3649 return vm;
3650 };
3651 Vue.prototype.$emit = function (event) {
3652 const vm = this;
3653 {
3654 const lowerCaseEvent = event.toLowerCase();
3655 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3656 tip(`Event "${lowerCaseEvent}" is emitted in component ` +
3657 `${formatComponentName(vm)} but the handler is registered for "${event}". ` +
3658 `Note that HTML attributes are case-insensitive and you cannot use ` +
3659 `v-on to listen to camelCase events when using in-DOM templates. ` +
3660 `You should probably use "${hyphenate(event)}" instead of "${event}".`);
3661 }
3662 }
3663 let cbs = vm._events[event];
3664 if (cbs) {
3665 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3666 const args = toArray(arguments, 1);
3667 const info = `event handler for "${event}"`;
3668 for (let i = 0, l = cbs.length; i < l; i++) {
3669 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3670 }
3671 }
3672 return vm;
3673 };
3674}
3675
3676let activeInstance = null;
3677let isUpdatingChildComponent = false;
3678function setActiveInstance(vm) {
3679 const prevActiveInstance = activeInstance;
3680 activeInstance = vm;
3681 return () => {
3682 activeInstance = prevActiveInstance;
3683 };
3684}
3685function initLifecycle(vm) {
3686 const options = vm.$options;
3687 // locate first non-abstract parent
3688 let parent = options.parent;
3689 if (parent && !options.abstract) {
3690 while (parent.$options.abstract && parent.$parent) {
3691 parent = parent.$parent;
3692 }
3693 parent.$children.push(vm);
3694 }
3695 vm.$parent = parent;
3696 vm.$root = parent ? parent.$root : vm;
3697 vm.$children = [];
3698 vm.$refs = {};
3699 vm._provided = parent ? parent._provided : Object.create(null);
3700 vm._watcher = null;
3701 vm._inactive = null;
3702 vm._directInactive = false;
3703 vm._isMounted = false;
3704 vm._isDestroyed = false;
3705 vm._isBeingDestroyed = false;
3706}
3707function lifecycleMixin(Vue) {
3708 Vue.prototype._update = function (vnode, hydrating) {
3709 const vm = this;
3710 const prevEl = vm.$el;
3711 const prevVnode = vm._vnode;
3712 const restoreActiveInstance = setActiveInstance(vm);
3713 vm._vnode = vnode;
3714 // Vue.prototype.__patch__ is injected in entry points
3715 // based on the rendering backend used.
3716 if (!prevVnode) {
3717 // initial render
3718 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3719 }
3720 else {
3721 // updates
3722 vm.$el = vm.__patch__(prevVnode, vnode);
3723 }
3724 restoreActiveInstance();
3725 // update __vue__ reference
3726 if (prevEl) {
3727 prevEl.__vue__ = null;
3728 }
3729 if (vm.$el) {
3730 vm.$el.__vue__ = vm;
3731 }
3732 // if parent is an HOC, update its $el as well
3733 let wrapper = vm;
3734 while (wrapper &&
3735 wrapper.$vnode &&
3736 wrapper.$parent &&
3737 wrapper.$vnode === wrapper.$parent._vnode) {
3738 wrapper.$parent.$el = wrapper.$el;
3739 wrapper = wrapper.$parent;
3740 }
3741 // updated hook is called by the scheduler to ensure that children are
3742 // updated in a parent's updated hook.
3743 };
3744 Vue.prototype.$forceUpdate = function () {
3745 const vm = this;
3746 if (vm._watcher) {
3747 vm._watcher.update();
3748 }
3749 };
3750 Vue.prototype.$destroy = function () {
3751 const vm = this;
3752 if (vm._isBeingDestroyed) {
3753 return;
3754 }
3755 callHook$1(vm, 'beforeDestroy');
3756 vm._isBeingDestroyed = true;
3757 // remove self from parent
3758 const parent = vm.$parent;
3759 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3760 remove$2(parent.$children, vm);
3761 }
3762 // teardown scope. this includes both the render watcher and other
3763 // watchers created
3764 vm._scope.stop();
3765 // remove reference from data ob
3766 // frozen object may not have observer.
3767 if (vm._data.__ob__) {
3768 vm._data.__ob__.vmCount--;
3769 }
3770 // call the last hook...
3771 vm._isDestroyed = true;
3772 // invoke destroy hooks on current rendered tree
3773 vm.__patch__(vm._vnode, null);
3774 // fire destroyed hook
3775 callHook$1(vm, 'destroyed');
3776 // turn off all instance listeners.
3777 vm.$off();
3778 // remove __vue__ reference
3779 if (vm.$el) {
3780 vm.$el.__vue__ = null;
3781 }
3782 // release circular reference (#6759)
3783 if (vm.$vnode) {
3784 vm.$vnode.parent = null;
3785 }
3786 };
3787}
3788function mountComponent(vm, el, hydrating) {
3789 vm.$el = el;
3790 if (!vm.$options.render) {
3791 // @ts-expect-error invalid type
3792 vm.$options.render = createEmptyVNode;
3793 {
3794 /* istanbul ignore if */
3795 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
3796 vm.$options.el ||
3797 el) {
3798 warn('You are using the runtime-only build of Vue where the template ' +
3799 'compiler is not available. Either pre-compile the templates into ' +
3800 'render functions, or use the compiler-included build.', vm);
3801 }
3802 else {
3803 warn('Failed to mount component: template or render function not defined.', vm);
3804 }
3805 }
3806 }
3807 callHook$1(vm, 'beforeMount');
3808 let updateComponent;
3809 /* istanbul ignore if */
3810 if (config.performance && mark) {
3811 updateComponent = () => {
3812 const name = vm._name;
3813 const id = vm._uid;
3814 const startTag = `vue-perf-start:${id}`;
3815 const endTag = `vue-perf-end:${id}`;
3816 mark(startTag);
3817 const vnode = vm._render();
3818 mark(endTag);
3819 measure(`vue ${name} render`, startTag, endTag);
3820 mark(startTag);
3821 vm._update(vnode, hydrating);
3822 mark(endTag);
3823 measure(`vue ${name} patch`, startTag, endTag);
3824 };
3825 }
3826 else {
3827 updateComponent = () => {
3828 vm._update(vm._render(), hydrating);
3829 };
3830 }
3831 const watcherOptions = {
3832 before() {
3833 if (vm._isMounted && !vm._isDestroyed) {
3834 callHook$1(vm, 'beforeUpdate');
3835 }
3836 }
3837 };
3838 {
3839 watcherOptions.onTrack = e => callHook$1(vm, 'renderTracked', [e]);
3840 watcherOptions.onTrigger = e => callHook$1(vm, 'renderTriggered', [e]);
3841 }
3842 // we set this to vm._watcher inside the watcher's constructor
3843 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
3844 // component's mounted hook), which relies on vm._watcher being already defined
3845 new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
3846 hydrating = false;
3847 // flush buffer for flush: "pre" watchers queued in setup()
3848 const preWatchers = vm._preWatchers;
3849 if (preWatchers) {
3850 for (let i = 0; i < preWatchers.length; i++) {
3851 preWatchers[i].run();
3852 }
3853 }
3854 // manually mounted instance, call mounted on self
3855 // mounted is called for render-created child components in its inserted hook
3856 if (vm.$vnode == null) {
3857 vm._isMounted = true;
3858 callHook$1(vm, 'mounted');
3859 }
3860 return vm;
3861}
3862function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
3863 {
3864 isUpdatingChildComponent = true;
3865 }
3866 // determine whether component has slot children
3867 // we need to do this before overwriting $options._renderChildren.
3868 // check if there are dynamic scopedSlots (hand-written or compiled but with
3869 // dynamic slot names). Static scoped slots compiled from template has the
3870 // "$stable" marker.
3871 const newScopedSlots = parentVnode.data.scopedSlots;
3872 const oldScopedSlots = vm.$scopedSlots;
3873 const hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
3874 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
3875 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
3876 (!newScopedSlots && vm.$scopedSlots.$key));
3877 // Any static slot children from the parent may have changed during parent's
3878 // update. Dynamic scoped slots may also have changed. In such cases, a forced
3879 // update is necessary to ensure correctness.
3880 let needsForceUpdate = !!(renderChildren || // has new static slots
3881 vm.$options._renderChildren || // has old static slots
3882 hasDynamicScopedSlot);
3883 const prevVNode = vm.$vnode;
3884 vm.$options._parentVnode = parentVnode;
3885 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
3886 if (vm._vnode) {
3887 // update child tree's parent
3888 vm._vnode.parent = parentVnode;
3889 }
3890 vm.$options._renderChildren = renderChildren;
3891 // update $attrs and $listeners hash
3892 // these are also reactive so they may trigger child update if the child
3893 // used them during render
3894 const attrs = parentVnode.data.attrs || emptyObject;
3895 if (vm._attrsProxy) {
3896 // force update if attrs are accessed and has changed since it may be
3897 // passed to a child component.
3898 if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
3899 needsForceUpdate = true;
3900 }
3901 }
3902 vm.$attrs = attrs;
3903 // update listeners
3904 listeners = listeners || emptyObject;
3905 const prevListeners = vm.$options._parentListeners;
3906 if (vm._listenersProxy) {
3907 syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
3908 }
3909 vm.$listeners = vm.$options._parentListeners = listeners;
3910 updateComponentListeners(vm, listeners, prevListeners);
3911 // update props
3912 if (propsData && vm.$options.props) {
3913 toggleObserving(false);
3914 const props = vm._props;
3915 const propKeys = vm.$options._propKeys || [];
3916 for (let i = 0; i < propKeys.length; i++) {
3917 const key = propKeys[i];
3918 const propOptions = vm.$options.props; // wtf flow?
3919 props[key] = validateProp(key, propOptions, propsData, vm);
3920 }
3921 toggleObserving(true);
3922 // keep a copy of raw propsData
3923 vm.$options.propsData = propsData;
3924 }
3925 // resolve slots + force update if has children
3926 if (needsForceUpdate) {
3927 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
3928 vm.$forceUpdate();
3929 }
3930 {
3931 isUpdatingChildComponent = false;
3932 }
3933}
3934function isInInactiveTree(vm) {
3935 while (vm && (vm = vm.$parent)) {
3936 if (vm._inactive)
3937 return true;
3938 }
3939 return false;
3940}
3941function activateChildComponent(vm, direct) {
3942 if (direct) {
3943 vm._directInactive = false;
3944 if (isInInactiveTree(vm)) {
3945 return;
3946 }
3947 }
3948 else if (vm._directInactive) {
3949 return;
3950 }
3951 if (vm._inactive || vm._inactive === null) {
3952 vm._inactive = false;
3953 for (let i = 0; i < vm.$children.length; i++) {
3954 activateChildComponent(vm.$children[i]);
3955 }
3956 callHook$1(vm, 'activated');
3957 }
3958}
3959function deactivateChildComponent(vm, direct) {
3960 if (direct) {
3961 vm._directInactive = true;
3962 if (isInInactiveTree(vm)) {
3963 return;
3964 }
3965 }
3966 if (!vm._inactive) {
3967 vm._inactive = true;
3968 for (let i = 0; i < vm.$children.length; i++) {
3969 deactivateChildComponent(vm.$children[i]);
3970 }
3971 callHook$1(vm, 'deactivated');
3972 }
3973}
3974function callHook$1(vm, hook, args, setContext = true) {
3975 // #7573 disable dep collection when invoking lifecycle hooks
3976 pushTarget();
3977 const prevInst = currentInstance;
3978 const prevScope = getCurrentScope();
3979 setContext && setCurrentInstance(vm);
3980 const handlers = vm.$options[hook];
3981 const info = `${hook} hook`;
3982 if (handlers) {
3983 for (let i = 0, j = handlers.length; i < j; i++) {
3984 invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
3985 }
3986 }
3987 if (vm._hasHookEvent) {
3988 vm.$emit('hook:' + hook);
3989 }
3990 if (setContext) {
3991 setCurrentInstance(prevInst);
3992 prevScope && prevScope.on();
3993 }
3994 popTarget();
3995}
3996
3997const MAX_UPDATE_COUNT = 100;
3998const queue = [];
3999const activatedChildren = [];
4000let has = {};
4001let circular = {};
4002let waiting = false;
4003let flushing = false;
4004let index = 0;
4005/**
4006 * Reset the scheduler's state.
4007 */
4008function resetSchedulerState() {
4009 index = queue.length = activatedChildren.length = 0;
4010 has = {};
4011 {
4012 circular = {};
4013 }
4014 waiting = flushing = false;
4015}
4016// Async edge case #6566 requires saving the timestamp when event listeners are
4017// attached. However, calling performance.now() has a perf overhead especially
4018// if the page has thousands of event listeners. Instead, we take a timestamp
4019// every time the scheduler flushes and use that for all event listeners
4020// attached during that flush.
4021let currentFlushTimestamp = 0;
4022// Async edge case fix requires storing an event listener's attach timestamp.
4023let getNow = Date.now;
4024// Determine what event timestamp the browser is using. Annoyingly, the
4025// timestamp can either be hi-res (relative to page load) or low-res
4026// (relative to UNIX epoch), so in order to compare time we have to use the
4027// same timestamp type when saving the flush timestamp.
4028// All IE versions use low-res event timestamps, and have problematic clock
4029// implementations (#9632)
4030if (inBrowser && !isIE) {
4031 const performance = window.performance;
4032 if (performance &&
4033 typeof performance.now === 'function' &&
4034 getNow() > document.createEvent('Event').timeStamp) {
4035 // if the event timestamp, although evaluated AFTER the Date.now(), is
4036 // smaller than it, it means the event is using a hi-res timestamp,
4037 // and we need to use the hi-res version for event listener timestamps as
4038 // well.
4039 getNow = () => performance.now();
4040 }
4041}
4042const sortCompareFn = (a, b) => {
4043 if (a.post) {
4044 if (!b.post)
4045 return 1;
4046 }
4047 else if (b.post) {
4048 return -1;
4049 }
4050 return a.id - b.id;
4051};
4052/**
4053 * Flush both queues and run the watchers.
4054 */
4055function flushSchedulerQueue() {
4056 currentFlushTimestamp = getNow();
4057 flushing = true;
4058 let watcher, id;
4059 // Sort queue before flush.
4060 // This ensures that:
4061 // 1. Components are updated from parent to child. (because parent is always
4062 // created before the child)
4063 // 2. A component's user watchers are run before its render watcher (because
4064 // user watchers are created before the render watcher)
4065 // 3. If a component is destroyed during a parent component's watcher run,
4066 // its watchers can be skipped.
4067 queue.sort(sortCompareFn);
4068 // do not cache length because more watchers might be pushed
4069 // as we run existing watchers
4070 for (index = 0; index < queue.length; index++) {
4071 watcher = queue[index];
4072 if (watcher.before) {
4073 watcher.before();
4074 }
4075 id = watcher.id;
4076 has[id] = null;
4077 watcher.run();
4078 // in dev build, check and stop circular updates.
4079 if (has[id] != null) {
4080 circular[id] = (circular[id] || 0) + 1;
4081 if (circular[id] > MAX_UPDATE_COUNT) {
4082 warn('You may have an infinite update loop ' +
4083 (watcher.user
4084 ? `in watcher with expression "${watcher.expression}"`
4085 : `in a component render function.`), watcher.vm);
4086 break;
4087 }
4088 }
4089 }
4090 // keep copies of post queues before resetting state
4091 const activatedQueue = activatedChildren.slice();
4092 const updatedQueue = queue.slice();
4093 resetSchedulerState();
4094 // call component updated and activated hooks
4095 callActivatedHooks(activatedQueue);
4096 callUpdatedHooks(updatedQueue);
4097 cleanupDeps();
4098 // devtool hook
4099 /* istanbul ignore if */
4100 if (devtools && config.devtools) {
4101 devtools.emit('flush');
4102 }
4103}
4104function callUpdatedHooks(queue) {
4105 let i = queue.length;
4106 while (i--) {
4107 const watcher = queue[i];
4108 const vm = watcher.vm;
4109 if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4110 callHook$1(vm, 'updated');
4111 }
4112 }
4113}
4114/**
4115 * Queue a kept-alive component that was activated during patch.
4116 * The queue will be processed after the entire tree has been patched.
4117 */
4118function queueActivatedComponent(vm) {
4119 // setting _inactive to false here so that a render function can
4120 // rely on checking whether it's in an inactive tree (e.g. router-view)
4121 vm._inactive = false;
4122 activatedChildren.push(vm);
4123}
4124function callActivatedHooks(queue) {
4125 for (let i = 0; i < queue.length; i++) {
4126 queue[i]._inactive = true;
4127 activateChildComponent(queue[i], true /* true */);
4128 }
4129}
4130/**
4131 * Push a watcher into the watcher queue.
4132 * Jobs with duplicate IDs will be skipped unless it's
4133 * pushed when the queue is being flushed.
4134 */
4135function queueWatcher(watcher) {
4136 const id = watcher.id;
4137 if (has[id] != null) {
4138 return;
4139 }
4140 if (watcher === Dep.target && watcher.noRecurse) {
4141 return;
4142 }
4143 has[id] = true;
4144 if (!flushing) {
4145 queue.push(watcher);
4146 }
4147 else {
4148 // if already flushing, splice the watcher based on its id
4149 // if already past its id, it will be run next immediately.
4150 let i = queue.length - 1;
4151 while (i > index && queue[i].id > watcher.id) {
4152 i--;
4153 }
4154 queue.splice(i + 1, 0, watcher);
4155 }
4156 // queue the flush
4157 if (!waiting) {
4158 waiting = true;
4159 if (!config.async) {
4160 flushSchedulerQueue();
4161 return;
4162 }
4163 nextTick(flushSchedulerQueue);
4164 }
4165}
4166
4167function initProvide(vm) {
4168 const provideOption = vm.$options.provide;
4169 if (provideOption) {
4170 const provided = isFunction(provideOption)
4171 ? provideOption.call(vm)
4172 : provideOption;
4173 if (!isObject(provided)) {
4174 return;
4175 }
4176 const source = resolveProvided(vm);
4177 // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
4178 // iterate the keys ourselves.
4179 const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
4180 for (let i = 0; i < keys.length; i++) {
4181 const key = keys[i];
4182 Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
4183 }
4184 }
4185}
4186function initInjections(vm) {
4187 const result = resolveInject(vm.$options.inject, vm);
4188 if (result) {
4189 toggleObserving(false);
4190 Object.keys(result).forEach(key => {
4191 /* istanbul ignore else */
4192 {
4193 defineReactive(vm, key, result[key], () => {
4194 warn(`Avoid mutating an injected value directly since the changes will be ` +
4195 `overwritten whenever the provided component re-renders. ` +
4196 `injection being mutated: "${key}"`, vm);
4197 });
4198 }
4199 });
4200 toggleObserving(true);
4201 }
4202}
4203function resolveInject(inject, vm) {
4204 if (inject) {
4205 // inject is :any because flow is not smart enough to figure out cached
4206 const result = Object.create(null);
4207 const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
4208 for (let i = 0; i < keys.length; i++) {
4209 const key = keys[i];
4210 // #6574 in case the inject object is observed...
4211 if (key === '__ob__')
4212 continue;
4213 const provideKey = inject[key].from;
4214 if (provideKey in vm._provided) {
4215 result[key] = vm._provided[provideKey];
4216 }
4217 else if ('default' in inject[key]) {
4218 const provideDefault = inject[key].default;
4219 result[key] = isFunction(provideDefault)
4220 ? provideDefault.call(vm)
4221 : provideDefault;
4222 }
4223 else {
4224 warn(`Injection "${key}" not found`, vm);
4225 }
4226 }
4227 return result;
4228 }
4229}
4230
4231function FunctionalRenderContext(data, props, children, parent, Ctor) {
4232 const options = Ctor.options;
4233 // ensure the createElement function in functional components
4234 // gets a unique context - this is necessary for correct named slot check
4235 let contextVm;
4236 if (hasOwn(parent, '_uid')) {
4237 contextVm = Object.create(parent);
4238 contextVm._original = parent;
4239 }
4240 else {
4241 // the context vm passed in is a functional context as well.
4242 // in this case we want to make sure we are able to get a hold to the
4243 // real context instance.
4244 contextVm = parent;
4245 // @ts-ignore
4246 parent = parent._original;
4247 }
4248 const isCompiled = isTrue(options._compiled);
4249 const needNormalization = !isCompiled;
4250 this.data = data;
4251 this.props = props;
4252 this.children = children;
4253 this.parent = parent;
4254 this.listeners = data.on || emptyObject;
4255 this.injections = resolveInject(options.inject, parent);
4256 this.slots = () => {
4257 if (!this.$slots) {
4258 normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent)));
4259 }
4260 return this.$slots;
4261 };
4262 Object.defineProperty(this, 'scopedSlots', {
4263 enumerable: true,
4264 get() {
4265 return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
4266 }
4267 });
4268 // support for compiled functional template
4269 if (isCompiled) {
4270 // exposing $options for renderStatic()
4271 this.$options = options;
4272 // pre-resolve slots for renderSlot()
4273 this.$slots = this.slots();
4274 this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
4275 }
4276 if (options._scopeId) {
4277 this._c = (a, b, c, d) => {
4278 const vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
4279 if (vnode && !isArray(vnode)) {
4280 vnode.fnScopeId = options._scopeId;
4281 vnode.fnContext = parent;
4282 }
4283 return vnode;
4284 };
4285 }
4286 else {
4287 this._c = (a, b, c, d) => createElement$1(contextVm, a, b, c, d, needNormalization);
4288 }
4289}
4290installRenderHelpers(FunctionalRenderContext.prototype);
4291function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
4292 const options = Ctor.options;
4293 const props = {};
4294 const propOptions = options.props;
4295 if (isDef(propOptions)) {
4296 for (const key in propOptions) {
4297 props[key] = validateProp(key, propOptions, propsData || emptyObject);
4298 }
4299 }
4300 else {
4301 if (isDef(data.attrs))
4302 mergeProps(props, data.attrs);
4303 if (isDef(data.props))
4304 mergeProps(props, data.props);
4305 }
4306 const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
4307 const vnode = options.render.call(null, renderContext._c, renderContext);
4308 if (vnode instanceof VNode) {
4309 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
4310 }
4311 else if (isArray(vnode)) {
4312 const vnodes = normalizeChildren(vnode) || [];
4313 const res = new Array(vnodes.length);
4314 for (let i = 0; i < vnodes.length; i++) {
4315 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
4316 }
4317 return res;
4318 }
4319}
4320function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
4321 // #7817 clone node before setting fnContext, otherwise if the node is reused
4322 // (e.g. it was from a cached normal slot) the fnContext causes named slots
4323 // that should not be matched to match.
4324 const clone = cloneVNode(vnode);
4325 clone.fnContext = contextVm;
4326 clone.fnOptions = options;
4327 {
4328 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
4329 renderContext;
4330 }
4331 if (data.slot) {
4332 (clone.data || (clone.data = {})).slot = data.slot;
4333 }
4334 return clone;
4335}
4336function mergeProps(to, from) {
4337 for (const key in from) {
4338 to[camelize(key)] = from[key];
4339 }
4340}
4341
4342function getComponentName(options) {
4343 return options.name || options.__name || options._componentTag;
4344}
4345// inline hooks to be invoked on component VNodes during patch
4346const componentVNodeHooks = {
4347 init(vnode, hydrating) {
4348 if (vnode.componentInstance &&
4349 !vnode.componentInstance._isDestroyed &&
4350 vnode.data.keepAlive) {
4351 // kept-alive components, treat as a patch
4352 const mountedNode = vnode; // work around flow
4353 componentVNodeHooks.prepatch(mountedNode, mountedNode);
4354 }
4355 else {
4356 const child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
4357 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
4358 }
4359 },
4360 prepatch(oldVnode, vnode) {
4361 const options = vnode.componentOptions;
4362 const child = (vnode.componentInstance = oldVnode.componentInstance);
4363 updateChildComponent(child, options.propsData, // updated props
4364 options.listeners, // updated listeners
4365 vnode, // new parent vnode
4366 options.children // new children
4367 );
4368 },
4369 insert(vnode) {
4370 const { context, componentInstance } = vnode;
4371 if (!componentInstance._isMounted) {
4372 componentInstance._isMounted = true;
4373 callHook$1(componentInstance, 'mounted');
4374 }
4375 if (vnode.data.keepAlive) {
4376 if (context._isMounted) {
4377 // vue-router#1212
4378 // During updates, a kept-alive component's child components may
4379 // change, so directly walking the tree here may call activated hooks
4380 // on incorrect children. Instead we push them into a queue which will
4381 // be processed after the whole patch process ended.
4382 queueActivatedComponent(componentInstance);
4383 }
4384 else {
4385 activateChildComponent(componentInstance, true /* direct */);
4386 }
4387 }
4388 },
4389 destroy(vnode) {
4390 const { componentInstance } = vnode;
4391 if (!componentInstance._isDestroyed) {
4392 if (!vnode.data.keepAlive) {
4393 componentInstance.$destroy();
4394 }
4395 else {
4396 deactivateChildComponent(componentInstance, true /* direct */);
4397 }
4398 }
4399 }
4400};
4401const hooksToMerge = Object.keys(componentVNodeHooks);
4402function createComponent(Ctor, data, context, children, tag) {
4403 if (isUndef(Ctor)) {
4404 return;
4405 }
4406 const baseCtor = context.$options._base;
4407 // plain options object: turn it into a constructor
4408 if (isObject(Ctor)) {
4409 Ctor = baseCtor.extend(Ctor);
4410 }
4411 // if at this stage it's not a constructor or an async component factory,
4412 // reject.
4413 if (typeof Ctor !== 'function') {
4414 {
4415 warn(`Invalid Component definition: ${String(Ctor)}`, context);
4416 }
4417 return;
4418 }
4419 // async component
4420 let asyncFactory;
4421 // @ts-expect-error
4422 if (isUndef(Ctor.cid)) {
4423 asyncFactory = Ctor;
4424 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
4425 if (Ctor === undefined) {
4426 // return a placeholder node for async component, which is rendered
4427 // as a comment node but preserves all the raw information for the node.
4428 // the information will be used for async server-rendering and hydration.
4429 return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
4430 }
4431 }
4432 data = data || {};
4433 // resolve constructor options in case global mixins are applied after
4434 // component constructor creation
4435 resolveConstructorOptions(Ctor);
4436 // transform component v-model data into props & events
4437 if (isDef(data.model)) {
4438 // @ts-expect-error
4439 transformModel(Ctor.options, data);
4440 }
4441 // extract props
4442 // @ts-expect-error
4443 const propsData = extractPropsFromVNodeData(data, Ctor, tag);
4444 // functional component
4445 // @ts-expect-error
4446 if (isTrue(Ctor.options.functional)) {
4447 return createFunctionalComponent(Ctor, propsData, data, context, children);
4448 }
4449 // extract listeners, since these needs to be treated as
4450 // child component listeners instead of DOM listeners
4451 const listeners = data.on;
4452 // replace with listeners with .native modifier
4453 // so it gets processed during parent component patch.
4454 data.on = data.nativeOn;
4455 // @ts-expect-error
4456 if (isTrue(Ctor.options.abstract)) {
4457 // abstract components do not keep anything
4458 // other than props & listeners & slot
4459 // work around flow
4460 const slot = data.slot;
4461 data = {};
4462 if (slot) {
4463 data.slot = slot;
4464 }
4465 }
4466 // install component management hooks onto the placeholder node
4467 installComponentHooks(data);
4468 // return a placeholder vnode
4469 // @ts-expect-error
4470 const name = getComponentName(Ctor.options) || tag;
4471 const vnode = new VNode(
4472 // @ts-expect-error
4473 `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context,
4474 // @ts-expect-error
4475 { Ctor, propsData, listeners, tag, children }, asyncFactory);
4476 return vnode;
4477}
4478function createComponentInstanceForVnode(
4479// we know it's MountedComponentVNode but flow doesn't
4480vnode,
4481// activeInstance in lifecycle state
4482parent) {
4483 const options = {
4484 _isComponent: true,
4485 _parentVnode: vnode,
4486 parent
4487 };
4488 // check inline-template render functions
4489 const inlineTemplate = vnode.data.inlineTemplate;
4490 if (isDef(inlineTemplate)) {
4491 options.render = inlineTemplate.render;
4492 options.staticRenderFns = inlineTemplate.staticRenderFns;
4493 }
4494 return new vnode.componentOptions.Ctor(options);
4495}
4496function installComponentHooks(data) {
4497 const hooks = data.hook || (data.hook = {});
4498 for (let i = 0; i < hooksToMerge.length; i++) {
4499 const key = hooksToMerge[i];
4500 const existing = hooks[key];
4501 const toMerge = componentVNodeHooks[key];
4502 // @ts-expect-error
4503 if (existing !== toMerge && !(existing && existing._merged)) {
4504 hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
4505 }
4506 }
4507}
4508function mergeHook(f1, f2) {
4509 const merged = (a, b) => {
4510 // flow complains about extra args which is why we use any
4511 f1(a, b);
4512 f2(a, b);
4513 };
4514 merged._merged = true;
4515 return merged;
4516}
4517// transform component v-model info (value and callback) into
4518// prop and event handler respectively.
4519function transformModel(options, data) {
4520 const prop = (options.model && options.model.prop) || 'value';
4521 const event = (options.model && options.model.event) || 'input';
4522 (data.attrs || (data.attrs = {}))[prop] = data.model.value;
4523 const on = data.on || (data.on = {});
4524 const existing = on[event];
4525 const callback = data.model.callback;
4526 if (isDef(existing)) {
4527 if (isArray(existing)
4528 ? existing.indexOf(callback) === -1
4529 : existing !== callback) {
4530 on[event] = [callback].concat(existing);
4531 }
4532 }
4533 else {
4534 on[event] = callback;
4535 }
4536}
4537
4538let warn = noop;
4539let tip = noop;
4540let generateComponentTrace; // work around flow check
4541let formatComponentName;
4542{
4543 const hasConsole = typeof console !== 'undefined';
4544 const classifyRE = /(?:^|[-_])(\w)/g;
4545 const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
4546 warn = (msg, vm = currentInstance) => {
4547 const trace = vm ? generateComponentTrace(vm) : '';
4548 if (config.warnHandler) {
4549 config.warnHandler.call(null, msg, vm, trace);
4550 }
4551 else if (hasConsole && !config.silent) {
4552 console.error(`[Vue warn]: ${msg}${trace}`);
4553 }
4554 };
4555 tip = (msg, vm) => {
4556 if (hasConsole && !config.silent) {
4557 console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : ''));
4558 }
4559 };
4560 formatComponentName = (vm, includeFile) => {
4561 if (vm.$root === vm) {
4562 return '<Root>';
4563 }
4564 const options = isFunction(vm) && vm.cid != null
4565 ? vm.options
4566 : vm._isVue
4567 ? vm.$options || vm.constructor.options
4568 : vm;
4569 let name = getComponentName(options);
4570 const file = options.__file;
4571 if (!name && file) {
4572 const match = file.match(/([^/\\]+)\.vue$/);
4573 name = match && match[1];
4574 }
4575 return ((name ? `<${classify(name)}>` : `<Anonymous>`) +
4576 (file && includeFile !== false ? ` at ${file}` : ''));
4577 };
4578 const repeat = (str, n) => {
4579 let res = '';
4580 while (n) {
4581 if (n % 2 === 1)
4582 res += str;
4583 if (n > 1)
4584 str += str;
4585 n >>= 1;
4586 }
4587 return res;
4588 };
4589 generateComponentTrace = (vm) => {
4590 if (vm._isVue && vm.$parent) {
4591 const tree = [];
4592 let currentRecursiveSequence = 0;
4593 while (vm) {
4594 if (tree.length > 0) {
4595 const last = tree[tree.length - 1];
4596 if (last.constructor === vm.constructor) {
4597 currentRecursiveSequence++;
4598 vm = vm.$parent;
4599 continue;
4600 }
4601 else if (currentRecursiveSequence > 0) {
4602 tree[tree.length - 1] = [last, currentRecursiveSequence];
4603 currentRecursiveSequence = 0;
4604 }
4605 }
4606 tree.push(vm);
4607 vm = vm.$parent;
4608 }
4609 return ('\n\nfound in\n\n' +
4610 tree
4611 .map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm)
4612 ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
4613 : formatComponentName(vm)}`)
4614 .join('\n'));
4615 }
4616 else {
4617 return `\n\n(found in ${formatComponentName(vm)})`;
4618 }
4619 };
4620}
4621
4622/**
4623 * Option overwriting strategies are functions that handle
4624 * how to merge a parent option value and a child option
4625 * value into the final value.
4626 */
4627const strats = config.optionMergeStrategies;
4628/**
4629 * Options with restrictions
4630 */
4631{
4632 strats.el = strats.propsData = function (parent, child, vm, key) {
4633 if (!vm) {
4634 warn(`option "${key}" can only be used during instance ` +
4635 'creation with the `new` keyword.');
4636 }
4637 return defaultStrat(parent, child);
4638 };
4639}
4640/**
4641 * Helper that recursively merges two data objects together.
4642 */
4643function mergeData(to, from, recursive = true) {
4644 if (!from)
4645 return to;
4646 let key, toVal, fromVal;
4647 const keys = hasSymbol
4648 ? Reflect.ownKeys(from)
4649 : Object.keys(from);
4650 for (let i = 0; i < keys.length; i++) {
4651 key = keys[i];
4652 // in case the object is already observed...
4653 if (key === '__ob__')
4654 continue;
4655 toVal = to[key];
4656 fromVal = from[key];
4657 if (!recursive || !hasOwn(to, key)) {
4658 set(to, key, fromVal);
4659 }
4660 else if (toVal !== fromVal &&
4661 isPlainObject(toVal) &&
4662 isPlainObject(fromVal)) {
4663 mergeData(toVal, fromVal);
4664 }
4665 }
4666 return to;
4667}
4668/**
4669 * Data
4670 */
4671function mergeDataOrFn(parentVal, childVal, vm) {
4672 if (!vm) {
4673 // in a Vue.extend merge, both should be functions
4674 if (!childVal) {
4675 return parentVal;
4676 }
4677 if (!parentVal) {
4678 return childVal;
4679 }
4680 // when parentVal & childVal are both present,
4681 // we need to return a function that returns the
4682 // merged result of both functions... no need to
4683 // check if parentVal is a function here because
4684 // it has to be a function to pass previous merges.
4685 return function mergedDataFn() {
4686 return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
4687 };
4688 }
4689 else {
4690 return function mergedInstanceDataFn() {
4691 // instance merge
4692 const instanceData = isFunction(childVal)
4693 ? childVal.call(vm, vm)
4694 : childVal;
4695 const defaultData = isFunction(parentVal)
4696 ? parentVal.call(vm, vm)
4697 : parentVal;
4698 if (instanceData) {
4699 return mergeData(instanceData, defaultData);
4700 }
4701 else {
4702 return defaultData;
4703 }
4704 };
4705 }
4706}
4707strats.data = function (parentVal, childVal, vm) {
4708 if (!vm) {
4709 if (childVal && typeof childVal !== 'function') {
4710 warn('The "data" option should be a function ' +
4711 'that returns a per-instance value in component ' +
4712 'definitions.', vm);
4713 return parentVal;
4714 }
4715 return mergeDataOrFn(parentVal, childVal);
4716 }
4717 return mergeDataOrFn(parentVal, childVal, vm);
4718};
4719/**
4720 * Hooks and props are merged as arrays.
4721 */
4722function mergeLifecycleHook(parentVal, childVal) {
4723 const res = childVal
4724 ? parentVal
4725 ? parentVal.concat(childVal)
4726 : isArray(childVal)
4727 ? childVal
4728 : [childVal]
4729 : parentVal;
4730 return res ? dedupeHooks(res) : res;
4731}
4732function dedupeHooks(hooks) {
4733 const res = [];
4734 for (let i = 0; i < hooks.length; i++) {
4735 if (res.indexOf(hooks[i]) === -1) {
4736 res.push(hooks[i]);
4737 }
4738 }
4739 return res;
4740}
4741LIFECYCLE_HOOKS.forEach(hook => {
4742 strats[hook] = mergeLifecycleHook;
4743});
4744/**
4745 * Assets
4746 *
4747 * When a vm is present (instance creation), we need to do
4748 * a three-way merge between constructor options, instance
4749 * options and parent options.
4750 */
4751function mergeAssets(parentVal, childVal, vm, key) {
4752 const res = Object.create(parentVal || null);
4753 if (childVal) {
4754 assertObjectType(key, childVal, vm);
4755 return extend(res, childVal);
4756 }
4757 else {
4758 return res;
4759 }
4760}
4761ASSET_TYPES.forEach(function (type) {
4762 strats[type + 's'] = mergeAssets;
4763});
4764/**
4765 * Watchers.
4766 *
4767 * Watchers hashes should not overwrite one
4768 * another, so we merge them as arrays.
4769 */
4770strats.watch = function (parentVal, childVal, vm, key) {
4771 // work around Firefox's Object.prototype.watch...
4772 //@ts-expect-error work around
4773 if (parentVal === nativeWatch)
4774 parentVal = undefined;
4775 //@ts-expect-error work around
4776 if (childVal === nativeWatch)
4777 childVal = undefined;
4778 /* istanbul ignore if */
4779 if (!childVal)
4780 return Object.create(parentVal || null);
4781 {
4782 assertObjectType(key, childVal, vm);
4783 }
4784 if (!parentVal)
4785 return childVal;
4786 const ret = {};
4787 extend(ret, parentVal);
4788 for (const key in childVal) {
4789 let parent = ret[key];
4790 const child = childVal[key];
4791 if (parent && !isArray(parent)) {
4792 parent = [parent];
4793 }
4794 ret[key] = parent ? parent.concat(child) : isArray(child) ? child : [child];
4795 }
4796 return ret;
4797};
4798/**
4799 * Other object hashes.
4800 */
4801strats.props =
4802 strats.methods =
4803 strats.inject =
4804 strats.computed =
4805 function (parentVal, childVal, vm, key) {
4806 if (childVal && true) {
4807 assertObjectType(key, childVal, vm);
4808 }
4809 if (!parentVal)
4810 return childVal;
4811 const ret = Object.create(null);
4812 extend(ret, parentVal);
4813 if (childVal)
4814 extend(ret, childVal);
4815 return ret;
4816 };
4817strats.provide = function (parentVal, childVal) {
4818 if (!parentVal)
4819 return childVal;
4820 return function () {
4821 const ret = Object.create(null);
4822 mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
4823 if (childVal) {
4824 mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
4825 );
4826 }
4827 return ret;
4828 };
4829};
4830/**
4831 * Default strategy.
4832 */
4833const defaultStrat = function (parentVal, childVal) {
4834 return childVal === undefined ? parentVal : childVal;
4835};
4836/**
4837 * Validate component names
4838 */
4839function checkComponents(options) {
4840 for (const key in options.components) {
4841 validateComponentName(key);
4842 }
4843}
4844function validateComponentName(name) {
4845 if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeRegExp.source}]*$`).test(name)) {
4846 warn('Invalid component name: "' +
4847 name +
4848 '". Component names ' +
4849 'should conform to valid custom element name in html5 specification.');
4850 }
4851 if (isBuiltInTag(name) || config.isReservedTag(name)) {
4852 warn('Do not use built-in or reserved HTML elements as component ' +
4853 'id: ' +
4854 name);
4855 }
4856}
4857/**
4858 * Ensure all props option syntax are normalized into the
4859 * Object-based format.
4860 */
4861function normalizeProps(options, vm) {
4862 const props = options.props;
4863 if (!props)
4864 return;
4865 const res = {};
4866 let i, val, name;
4867 if (isArray(props)) {
4868 i = props.length;
4869 while (i--) {
4870 val = props[i];
4871 if (typeof val === 'string') {
4872 name = camelize(val);
4873 res[name] = { type: null };
4874 }
4875 else {
4876 warn('props must be strings when using array syntax.');
4877 }
4878 }
4879 }
4880 else if (isPlainObject(props)) {
4881 for (const key in props) {
4882 val = props[key];
4883 name = camelize(key);
4884 res[name] = isPlainObject(val) ? val : { type: val };
4885 }
4886 }
4887 else {
4888 warn(`Invalid value for option "props": expected an Array or an Object, ` +
4889 `but got ${toRawType(props)}.`, vm);
4890 }
4891 options.props = res;
4892}
4893/**
4894 * Normalize all injections into Object-based format
4895 */
4896function normalizeInject(options, vm) {
4897 const inject = options.inject;
4898 if (!inject)
4899 return;
4900 const normalized = (options.inject = {});
4901 if (isArray(inject)) {
4902 for (let i = 0; i < inject.length; i++) {
4903 normalized[inject[i]] = { from: inject[i] };
4904 }
4905 }
4906 else if (isPlainObject(inject)) {
4907 for (const key in inject) {
4908 const val = inject[key];
4909 normalized[key] = isPlainObject(val)
4910 ? extend({ from: key }, val)
4911 : { from: val };
4912 }
4913 }
4914 else {
4915 warn(`Invalid value for option "inject": expected an Array or an Object, ` +
4916 `but got ${toRawType(inject)}.`, vm);
4917 }
4918}
4919/**
4920 * Normalize raw function directives into object format.
4921 */
4922function normalizeDirectives$1(options) {
4923 const dirs = options.directives;
4924 if (dirs) {
4925 for (const key in dirs) {
4926 const def = dirs[key];
4927 if (isFunction(def)) {
4928 dirs[key] = { bind: def, update: def };
4929 }
4930 }
4931 }
4932}
4933function assertObjectType(name, value, vm) {
4934 if (!isPlainObject(value)) {
4935 warn(`Invalid value for option "${name}": expected an Object, ` +
4936 `but got ${toRawType(value)}.`, vm);
4937 }
4938}
4939/**
4940 * Merge two option objects into a new one.
4941 * Core utility used in both instantiation and inheritance.
4942 */
4943function mergeOptions(parent, child, vm) {
4944 {
4945 checkComponents(child);
4946 }
4947 if (isFunction(child)) {
4948 // @ts-expect-error
4949 child = child.options;
4950 }
4951 normalizeProps(child, vm);
4952 normalizeInject(child, vm);
4953 normalizeDirectives$1(child);
4954 // Apply extends and mixins on the child options,
4955 // but only if it is a raw options object that isn't
4956 // the result of another mergeOptions call.
4957 // Only merged options has the _base property.
4958 if (!child._base) {
4959 if (child.extends) {
4960 parent = mergeOptions(parent, child.extends, vm);
4961 }
4962 if (child.mixins) {
4963 for (let i = 0, l = child.mixins.length; i < l; i++) {
4964 parent = mergeOptions(parent, child.mixins[i], vm);
4965 }
4966 }
4967 }
4968 const options = {};
4969 let key;
4970 for (key in parent) {
4971 mergeField(key);
4972 }
4973 for (key in child) {
4974 if (!hasOwn(parent, key)) {
4975 mergeField(key);
4976 }
4977 }
4978 function mergeField(key) {
4979 const strat = strats[key] || defaultStrat;
4980 options[key] = strat(parent[key], child[key], vm, key);
4981 }
4982 return options;
4983}
4984/**
4985 * Resolve an asset.
4986 * This function is used because child instances need access
4987 * to assets defined in its ancestor chain.
4988 */
4989function resolveAsset(options, type, id, warnMissing) {
4990 /* istanbul ignore if */
4991 if (typeof id !== 'string') {
4992 return;
4993 }
4994 const assets = options[type];
4995 // check local registration variations first
4996 if (hasOwn(assets, id))
4997 return assets[id];
4998 const camelizedId = camelize(id);
4999 if (hasOwn(assets, camelizedId))
5000 return assets[camelizedId];
5001 const PascalCaseId = capitalize(camelizedId);
5002 if (hasOwn(assets, PascalCaseId))
5003 return assets[PascalCaseId];
5004 // fallback to prototype chain
5005 const res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
5006 if (warnMissing && !res) {
5007 warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
5008 }
5009 return res;
5010}
5011
5012function validateProp(key, propOptions, propsData, vm) {
5013 const prop = propOptions[key];
5014 const absent = !hasOwn(propsData, key);
5015 let value = propsData[key];
5016 // boolean casting
5017 const booleanIndex = getTypeIndex(Boolean, prop.type);
5018 if (booleanIndex > -1) {
5019 if (absent && !hasOwn(prop, 'default')) {
5020 value = false;
5021 }
5022 else if (value === '' || value === hyphenate(key)) {
5023 // only cast empty string / same name to boolean if
5024 // boolean has higher priority
5025 const stringIndex = getTypeIndex(String, prop.type);
5026 if (stringIndex < 0 || booleanIndex < stringIndex) {
5027 value = true;
5028 }
5029 }
5030 }
5031 // check default value
5032 if (value === undefined) {
5033 value = getPropDefaultValue(vm, prop, key);
5034 // since the default value is a fresh copy,
5035 // make sure to observe it.
5036 const prevShouldObserve = shouldObserve;
5037 toggleObserving(true);
5038 observe(value);
5039 toggleObserving(prevShouldObserve);
5040 }
5041 {
5042 assertProp(prop, key, value, vm, absent);
5043 }
5044 return value;
5045}
5046/**
5047 * Get the default value of a prop.
5048 */
5049function getPropDefaultValue(vm, prop, key) {
5050 // no default, return undefined
5051 if (!hasOwn(prop, 'default')) {
5052 return undefined;
5053 }
5054 const def = prop.default;
5055 // warn against non-factory defaults for Object & Array
5056 if (isObject(def)) {
5057 warn('Invalid default value for prop "' +
5058 key +
5059 '": ' +
5060 'Props with type Object/Array must use a factory function ' +
5061 'to return the default value.', vm);
5062 }
5063 // the raw prop value was also undefined from previous render,
5064 // return previous default value to avoid unnecessary watcher trigger
5065 if (vm &&
5066 vm.$options.propsData &&
5067 vm.$options.propsData[key] === undefined &&
5068 vm._props[key] !== undefined) {
5069 return vm._props[key];
5070 }
5071 // call factory function for non-Function types
5072 // a value is Function if its prototype is function even across different execution context
5073 return isFunction(def) && getType(prop.type) !== 'Function'
5074 ? def.call(vm)
5075 : def;
5076}
5077/**
5078 * Assert whether a prop is valid.
5079 */
5080function assertProp(prop, name, value, vm, absent) {
5081 if (prop.required && absent) {
5082 warn('Missing required prop: "' + name + '"', vm);
5083 return;
5084 }
5085 if (value == null && !prop.required) {
5086 return;
5087 }
5088 let type = prop.type;
5089 let valid = !type || type === true;
5090 const expectedTypes = [];
5091 if (type) {
5092 if (!isArray(type)) {
5093 type = [type];
5094 }
5095 for (let i = 0; i < type.length && !valid; i++) {
5096 const assertedType = assertType(value, type[i], vm);
5097 expectedTypes.push(assertedType.expectedType || '');
5098 valid = assertedType.valid;
5099 }
5100 }
5101 const haveExpectedTypes = expectedTypes.some(t => t);
5102 if (!valid && haveExpectedTypes) {
5103 warn(getInvalidTypeMessage(name, value, expectedTypes), vm);
5104 return;
5105 }
5106 const validator = prop.validator;
5107 if (validator) {
5108 if (!validator(value)) {
5109 warn('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
5110 }
5111 }
5112}
5113const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
5114function assertType(value, type, vm) {
5115 let valid;
5116 const expectedType = getType(type);
5117 if (simpleCheckRE.test(expectedType)) {
5118 const t = typeof value;
5119 valid = t === expectedType.toLowerCase();
5120 // for primitive wrapper objects
5121 if (!valid && t === 'object') {
5122 valid = value instanceof type;
5123 }
5124 }
5125 else if (expectedType === 'Object') {
5126 valid = isPlainObject(value);
5127 }
5128 else if (expectedType === 'Array') {
5129 valid = isArray(value);
5130 }
5131 else {
5132 try {
5133 valid = value instanceof type;
5134 }
5135 catch (e) {
5136 warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
5137 valid = false;
5138 }
5139 }
5140 return {
5141 valid,
5142 expectedType
5143 };
5144}
5145const functionTypeCheckRE = /^\s*function (\w+)/;
5146/**
5147 * Use function string name to check built-in types,
5148 * because a simple equality check will fail when running
5149 * across different vms / iframes.
5150 */
5151function getType(fn) {
5152 const match = fn && fn.toString().match(functionTypeCheckRE);
5153 return match ? match[1] : '';
5154}
5155function isSameType(a, b) {
5156 return getType(a) === getType(b);
5157}
5158function getTypeIndex(type, expectedTypes) {
5159 if (!isArray(expectedTypes)) {
5160 return isSameType(expectedTypes, type) ? 0 : -1;
5161 }
5162 for (let i = 0, len = expectedTypes.length; i < len; i++) {
5163 if (isSameType(expectedTypes[i], type)) {
5164 return i;
5165 }
5166 }
5167 return -1;
5168}
5169function getInvalidTypeMessage(name, value, expectedTypes) {
5170 let message = `Invalid prop: type check failed for prop "${name}".` +
5171 ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
5172 const expectedType = expectedTypes[0];
5173 const receivedType = toRawType(value);
5174 // check if we need to specify expected value
5175 if (expectedTypes.length === 1 &&
5176 isExplicable(expectedType) &&
5177 isExplicable(typeof value) &&
5178 !isBoolean(expectedType, receivedType)) {
5179 message += ` with value ${styleValue(value, expectedType)}`;
5180 }
5181 message += `, got ${receivedType} `;
5182 // check if we need to specify received value
5183 if (isExplicable(receivedType)) {
5184 message += `with value ${styleValue(value, receivedType)}.`;
5185 }
5186 return message;
5187}
5188function styleValue(value, type) {
5189 if (type === 'String') {
5190 return `"${value}"`;
5191 }
5192 else if (type === 'Number') {
5193 return `${Number(value)}`;
5194 }
5195 else {
5196 return `${value}`;
5197 }
5198}
5199const EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
5200function isExplicable(value) {
5201 return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem);
5202}
5203function isBoolean(...args) {
5204 return args.some(elem => elem.toLowerCase() === 'boolean');
5205}
5206
5207/* not type checking this file because flow doesn't play well with Proxy */
5208let initProxy;
5209{
5210 const allowedGlobals = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
5211 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
5212 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
5213 'require' // for Webpack/Browserify
5214 );
5215 const warnNonPresent = (target, key) => {
5216 warn(`Property or method "${key}" is not defined on the instance but ` +
5217 'referenced during render. Make sure that this property is reactive, ' +
5218 'either in the data option, or for class-based components, by ' +
5219 'initializing the property. ' +
5220 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
5221 };
5222 const warnReservedPrefix = (target, key) => {
5223 warn(`Property "${key}" must be accessed with "$data.${key}" because ` +
5224 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
5225 'prevent conflicts with Vue internals. ' +
5226 'See: https://v2.vuejs.org/v2/api/#data', target);
5227 };
5228 const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
5229 if (hasProxy) {
5230 const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
5231 config.keyCodes = new Proxy(config.keyCodes, {
5232 set(target, key, value) {
5233 if (isBuiltInModifier(key)) {
5234 warn(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`);
5235 return false;
5236 }
5237 else {
5238 target[key] = value;
5239 return true;
5240 }
5241 }
5242 });
5243 }
5244 const hasHandler = {
5245 has(target, key) {
5246 const has = key in target;
5247 const isAllowed = allowedGlobals(key) ||
5248 (typeof key === 'string' &&
5249 key.charAt(0) === '_' &&
5250 !(key in target.$data));
5251 if (!has && !isAllowed) {
5252 if (key in target.$data)
5253 warnReservedPrefix(target, key);
5254 else
5255 warnNonPresent(target, key);
5256 }
5257 return has || !isAllowed;
5258 }
5259 };
5260 const getHandler = {
5261 get(target, key) {
5262 if (typeof key === 'string' && !(key in target)) {
5263 if (key in target.$data)
5264 warnReservedPrefix(target, key);
5265 else
5266 warnNonPresent(target, key);
5267 }
5268 return target[key];
5269 }
5270 };
5271 initProxy = function initProxy(vm) {
5272 if (hasProxy) {
5273 // determine which proxy handler to use
5274 const options = vm.$options;
5275 const handlers = options.render && options.render._withStripped ? getHandler : hasHandler;
5276 vm._renderProxy = new Proxy(vm, handlers);
5277 }
5278 else {
5279 vm._renderProxy = vm;
5280 }
5281 };
5282}
5283
5284const sharedPropertyDefinition = {
5285 enumerable: true,
5286 configurable: true,
5287 get: noop,
5288 set: noop
5289};
5290function proxy(target, sourceKey, key) {
5291 sharedPropertyDefinition.get = function proxyGetter() {
5292 return this[sourceKey][key];
5293 };
5294 sharedPropertyDefinition.set = function proxySetter(val) {
5295 this[sourceKey][key] = val;
5296 };
5297 Object.defineProperty(target, key, sharedPropertyDefinition);
5298}
5299function initState(vm) {
5300 const opts = vm.$options;
5301 if (opts.props)
5302 initProps$1(vm, opts.props);
5303 // Composition API
5304 initSetup(vm);
5305 if (opts.methods)
5306 initMethods(vm, opts.methods);
5307 if (opts.data) {
5308 initData(vm);
5309 }
5310 else {
5311 const ob = observe((vm._data = {}));
5312 ob && ob.vmCount++;
5313 }
5314 if (opts.computed)
5315 initComputed$1(vm, opts.computed);
5316 if (opts.watch && opts.watch !== nativeWatch) {
5317 initWatch(vm, opts.watch);
5318 }
5319}
5320function initProps$1(vm, propsOptions) {
5321 const propsData = vm.$options.propsData || {};
5322 const props = (vm._props = shallowReactive({}));
5323 // cache prop keys so that future props updates can iterate using Array
5324 // instead of dynamic object key enumeration.
5325 const keys = (vm.$options._propKeys = []);
5326 const isRoot = !vm.$parent;
5327 // root instance props should be converted
5328 if (!isRoot) {
5329 toggleObserving(false);
5330 }
5331 for (const key in propsOptions) {
5332 keys.push(key);
5333 const value = validateProp(key, propsOptions, propsData, vm);
5334 /* istanbul ignore else */
5335 {
5336 const hyphenatedKey = hyphenate(key);
5337 if (isReservedAttribute(hyphenatedKey) ||
5338 config.isReservedAttr(hyphenatedKey)) {
5339 warn(`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`, vm);
5340 }
5341 defineReactive(props, key, value, () => {
5342 if (!isRoot && !isUpdatingChildComponent) {
5343 warn(`Avoid mutating a prop directly since the value will be ` +
5344 `overwritten whenever the parent component re-renders. ` +
5345 `Instead, use a data or computed property based on the prop's ` +
5346 `value. Prop being mutated: "${key}"`, vm);
5347 }
5348 });
5349 }
5350 // static props are already proxied on the component's prototype
5351 // during Vue.extend(). We only need to proxy props defined at
5352 // instantiation here.
5353 if (!(key in vm)) {
5354 proxy(vm, `_props`, key);
5355 }
5356 }
5357 toggleObserving(true);
5358}
5359function initData(vm) {
5360 let data = vm.$options.data;
5361 data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
5362 if (!isPlainObject(data)) {
5363 data = {};
5364 warn('data functions should return an object:\n' +
5365 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
5366 }
5367 // proxy data on instance
5368 const keys = Object.keys(data);
5369 const props = vm.$options.props;
5370 const methods = vm.$options.methods;
5371 let i = keys.length;
5372 while (i--) {
5373 const key = keys[i];
5374 {
5375 if (methods && hasOwn(methods, key)) {
5376 warn(`Method "${key}" has already been defined as a data property.`, vm);
5377 }
5378 }
5379 if (props && hasOwn(props, key)) {
5380 warn(`The data property "${key}" is already declared as a prop. ` +
5381 `Use prop default value instead.`, vm);
5382 }
5383 else if (!isReserved(key)) {
5384 proxy(vm, `_data`, key);
5385 }
5386 }
5387 // observe data
5388 const ob = observe(data);
5389 ob && ob.vmCount++;
5390}
5391function getData(data, vm) {
5392 // #7573 disable dep collection when invoking data getters
5393 pushTarget();
5394 try {
5395 return data.call(vm, vm);
5396 }
5397 catch (e) {
5398 handleError(e, vm, `data()`);
5399 return {};
5400 }
5401 finally {
5402 popTarget();
5403 }
5404}
5405const computedWatcherOptions = { lazy: true };
5406function initComputed$1(vm, computed) {
5407 // $flow-disable-line
5408 const watchers = (vm._computedWatchers = Object.create(null));
5409 // computed properties are just getters during SSR
5410 const isSSR = isServerRendering();
5411 for (const key in computed) {
5412 const userDef = computed[key];
5413 const getter = isFunction(userDef) ? userDef : userDef.get;
5414 if (getter == null) {
5415 warn(`Getter is missing for computed property "${key}".`, vm);
5416 }
5417 if (!isSSR) {
5418 // create internal watcher for the computed property.
5419 watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
5420 }
5421 // component-defined computed properties are already defined on the
5422 // component prototype. We only need to define computed properties defined
5423 // at instantiation here.
5424 if (!(key in vm)) {
5425 defineComputed(vm, key, userDef);
5426 }
5427 else {
5428 if (key in vm.$data) {
5429 warn(`The computed property "${key}" is already defined in data.`, vm);
5430 }
5431 else if (vm.$options.props && key in vm.$options.props) {
5432 warn(`The computed property "${key}" is already defined as a prop.`, vm);
5433 }
5434 else if (vm.$options.methods && key in vm.$options.methods) {
5435 warn(`The computed property "${key}" is already defined as a method.`, vm);
5436 }
5437 }
5438 }
5439}
5440function defineComputed(target, key, userDef) {
5441 const shouldCache = !isServerRendering();
5442 if (isFunction(userDef)) {
5443 sharedPropertyDefinition.get = shouldCache
5444 ? createComputedGetter(key)
5445 : createGetterInvoker(userDef);
5446 sharedPropertyDefinition.set = noop;
5447 }
5448 else {
5449 sharedPropertyDefinition.get = userDef.get
5450 ? shouldCache && userDef.cache !== false
5451 ? createComputedGetter(key)
5452 : createGetterInvoker(userDef.get)
5453 : noop;
5454 sharedPropertyDefinition.set = userDef.set || noop;
5455 }
5456 if (sharedPropertyDefinition.set === noop) {
5457 sharedPropertyDefinition.set = function () {
5458 warn(`Computed property "${key}" was assigned to but it has no setter.`, this);
5459 };
5460 }
5461 Object.defineProperty(target, key, sharedPropertyDefinition);
5462}
5463function createComputedGetter(key) {
5464 return function computedGetter() {
5465 const watcher = this._computedWatchers && this._computedWatchers[key];
5466 if (watcher) {
5467 if (watcher.dirty) {
5468 watcher.evaluate();
5469 }
5470 if (Dep.target) {
5471 if (Dep.target.onTrack) {
5472 Dep.target.onTrack({
5473 effect: Dep.target,
5474 target: this,
5475 type: "get" /* TrackOpTypes.GET */,
5476 key
5477 });
5478 }
5479 watcher.depend();
5480 }
5481 return watcher.value;
5482 }
5483 };
5484}
5485function createGetterInvoker(fn) {
5486 return function computedGetter() {
5487 return fn.call(this, this);
5488 };
5489}
5490function initMethods(vm, methods) {
5491 const props = vm.$options.props;
5492 for (const key in methods) {
5493 {
5494 if (typeof methods[key] !== 'function') {
5495 warn(`Method "${key}" has type "${typeof methods[key]}" in the component definition. ` +
5496 `Did you reference the function correctly?`, vm);
5497 }
5498 if (props && hasOwn(props, key)) {
5499 warn(`Method "${key}" has already been defined as a prop.`, vm);
5500 }
5501 if (key in vm && isReserved(key)) {
5502 warn(`Method "${key}" conflicts with an existing Vue instance method. ` +
5503 `Avoid defining component methods that start with _ or $.`);
5504 }
5505 }
5506 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
5507 }
5508}
5509function initWatch(vm, watch) {
5510 for (const key in watch) {
5511 const handler = watch[key];
5512 if (isArray(handler)) {
5513 for (let i = 0; i < handler.length; i++) {
5514 createWatcher(vm, key, handler[i]);
5515 }
5516 }
5517 else {
5518 createWatcher(vm, key, handler);
5519 }
5520 }
5521}
5522function createWatcher(vm, expOrFn, handler, options) {
5523 if (isPlainObject(handler)) {
5524 options = handler;
5525 handler = handler.handler;
5526 }
5527 if (typeof handler === 'string') {
5528 handler = vm[handler];
5529 }
5530 return vm.$watch(expOrFn, handler, options);
5531}
5532function stateMixin(Vue) {
5533 // flow somehow has problems with directly declared definition object
5534 // when using Object.defineProperty, so we have to procedurally build up
5535 // the object here.
5536 const dataDef = {};
5537 dataDef.get = function () {
5538 return this._data;
5539 };
5540 const propsDef = {};
5541 propsDef.get = function () {
5542 return this._props;
5543 };
5544 {
5545 dataDef.set = function () {
5546 warn('Avoid replacing instance root $data. ' +
5547 'Use nested data properties instead.', this);
5548 };
5549 propsDef.set = function () {
5550 warn(`$props is readonly.`, this);
5551 };
5552 }
5553 Object.defineProperty(Vue.prototype, '$data', dataDef);
5554 Object.defineProperty(Vue.prototype, '$props', propsDef);
5555 Vue.prototype.$set = set;
5556 Vue.prototype.$delete = del;
5557 Vue.prototype.$watch = function (expOrFn, cb, options) {
5558 const vm = this;
5559 if (isPlainObject(cb)) {
5560 return createWatcher(vm, expOrFn, cb, options);
5561 }
5562 options = options || {};
5563 options.user = true;
5564 const watcher = new Watcher(vm, expOrFn, cb, options);
5565 if (options.immediate) {
5566 const info = `callback for immediate watcher "${watcher.expression}"`;
5567 pushTarget();
5568 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
5569 popTarget();
5570 }
5571 return function unwatchFn() {
5572 watcher.teardown();
5573 };
5574 };
5575}
5576
5577let uid = 0;
5578function initMixin$1(Vue) {
5579 Vue.prototype._init = function (options) {
5580 const vm = this;
5581 // a uid
5582 vm._uid = uid++;
5583 let startTag, endTag;
5584 /* istanbul ignore if */
5585 if (config.performance && mark) {
5586 startTag = `vue-perf-start:${vm._uid}`;
5587 endTag = `vue-perf-end:${vm._uid}`;
5588 mark(startTag);
5589 }
5590 // a flag to mark this as a Vue instance without having to do instanceof
5591 // check
5592 vm._isVue = true;
5593 // avoid instances from being observed
5594 vm.__v_skip = true;
5595 // effect scope
5596 vm._scope = new EffectScope(true /* detached */);
5597 vm._scope._vm = true;
5598 // merge options
5599 if (options && options._isComponent) {
5600 // optimize internal component instantiation
5601 // since dynamic options merging is pretty slow, and none of the
5602 // internal component options needs special treatment.
5603 initInternalComponent(vm, options);
5604 }
5605 else {
5606 vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
5607 }
5608 /* istanbul ignore else */
5609 {
5610 initProxy(vm);
5611 }
5612 // expose real self
5613 vm._self = vm;
5614 initLifecycle(vm);
5615 initEvents(vm);
5616 initRender(vm);
5617 callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
5618 initInjections(vm); // resolve injections before data/props
5619 initState(vm);
5620 initProvide(vm); // resolve provide after data/props
5621 callHook$1(vm, 'created');
5622 /* istanbul ignore if */
5623 if (config.performance && mark) {
5624 vm._name = formatComponentName(vm, false);
5625 mark(endTag);
5626 measure(`vue ${vm._name} init`, startTag, endTag);
5627 }
5628 if (vm.$options.el) {
5629 vm.$mount(vm.$options.el);
5630 }
5631 };
5632}
5633function initInternalComponent(vm, options) {
5634 const opts = (vm.$options = Object.create(vm.constructor.options));
5635 // doing this because it's faster than dynamic enumeration.
5636 const parentVnode = options._parentVnode;
5637 opts.parent = options.parent;
5638 opts._parentVnode = parentVnode;
5639 const vnodeComponentOptions = parentVnode.componentOptions;
5640 opts.propsData = vnodeComponentOptions.propsData;
5641 opts._parentListeners = vnodeComponentOptions.listeners;
5642 opts._renderChildren = vnodeComponentOptions.children;
5643 opts._componentTag = vnodeComponentOptions.tag;
5644 if (options.render) {
5645 opts.render = options.render;
5646 opts.staticRenderFns = options.staticRenderFns;
5647 }
5648}
5649function resolveConstructorOptions(Ctor) {
5650 let options = Ctor.options;
5651 if (Ctor.super) {
5652 const superOptions = resolveConstructorOptions(Ctor.super);
5653 const cachedSuperOptions = Ctor.superOptions;
5654 if (superOptions !== cachedSuperOptions) {
5655 // super option changed,
5656 // need to resolve new options.
5657 Ctor.superOptions = superOptions;
5658 // check if there are any late-modified/attached options (#4976)
5659 const modifiedOptions = resolveModifiedOptions(Ctor);
5660 // update base extend options
5661 if (modifiedOptions) {
5662 extend(Ctor.extendOptions, modifiedOptions);
5663 }
5664 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5665 if (options.name) {
5666 options.components[options.name] = Ctor;
5667 }
5668 }
5669 }
5670 return options;
5671}
5672function resolveModifiedOptions(Ctor) {
5673 let modified;
5674 const latest = Ctor.options;
5675 const sealed = Ctor.sealedOptions;
5676 for (const key in latest) {
5677 if (latest[key] !== sealed[key]) {
5678 if (!modified)
5679 modified = {};
5680 modified[key] = latest[key];
5681 }
5682 }
5683 return modified;
5684}
5685
5686function Vue(options) {
5687 if (!(this instanceof Vue)) {
5688 warn('Vue is a constructor and should be called with the `new` keyword');
5689 }
5690 this._init(options);
5691}
5692//@ts-expect-error Vue has function type
5693initMixin$1(Vue);
5694//@ts-expect-error Vue has function type
5695stateMixin(Vue);
5696//@ts-expect-error Vue has function type
5697eventsMixin(Vue);
5698//@ts-expect-error Vue has function type
5699lifecycleMixin(Vue);
5700//@ts-expect-error Vue has function type
5701renderMixin(Vue);
5702
5703function initUse(Vue) {
5704 Vue.use = function (plugin) {
5705 const installedPlugins = this._installedPlugins || (this._installedPlugins = []);
5706 if (installedPlugins.indexOf(plugin) > -1) {
5707 return this;
5708 }
5709 // additional parameters
5710 const args = toArray(arguments, 1);
5711 args.unshift(this);
5712 if (isFunction(plugin.install)) {
5713 plugin.install.apply(plugin, args);
5714 }
5715 else if (isFunction(plugin)) {
5716 plugin.apply(null, args);
5717 }
5718 installedPlugins.push(plugin);
5719 return this;
5720 };
5721}
5722
5723function initMixin(Vue) {
5724 Vue.mixin = function (mixin) {
5725 this.options = mergeOptions(this.options, mixin);
5726 return this;
5727 };
5728}
5729
5730function initExtend(Vue) {
5731 /**
5732 * Each instance constructor, including Vue, has a unique
5733 * cid. This enables us to create wrapped "child
5734 * constructors" for prototypal inheritance and cache them.
5735 */
5736 Vue.cid = 0;
5737 let cid = 1;
5738 /**
5739 * Class inheritance
5740 */
5741 Vue.extend = function (extendOptions) {
5742 extendOptions = extendOptions || {};
5743 const Super = this;
5744 const SuperId = Super.cid;
5745 const cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5746 if (cachedCtors[SuperId]) {
5747 return cachedCtors[SuperId];
5748 }
5749 const name = getComponentName(extendOptions) || getComponentName(Super.options);
5750 if (name) {
5751 validateComponentName(name);
5752 }
5753 const Sub = function VueComponent(options) {
5754 this._init(options);
5755 };
5756 Sub.prototype = Object.create(Super.prototype);
5757 Sub.prototype.constructor = Sub;
5758 Sub.cid = cid++;
5759 Sub.options = mergeOptions(Super.options, extendOptions);
5760 Sub['super'] = Super;
5761 // For props and computed properties, we define the proxy getters on
5762 // the Vue instances at extension time, on the extended prototype. This
5763 // avoids Object.defineProperty calls for each instance created.
5764 if (Sub.options.props) {
5765 initProps(Sub);
5766 }
5767 if (Sub.options.computed) {
5768 initComputed(Sub);
5769 }
5770 // allow further extension/mixin/plugin usage
5771 Sub.extend = Super.extend;
5772 Sub.mixin = Super.mixin;
5773 Sub.use = Super.use;
5774 // create asset registers, so extended classes
5775 // can have their private assets too.
5776 ASSET_TYPES.forEach(function (type) {
5777 Sub[type] = Super[type];
5778 });
5779 // enable recursive self-lookup
5780 if (name) {
5781 Sub.options.components[name] = Sub;
5782 }
5783 // keep a reference to the super options at extension time.
5784 // later at instantiation we can check if Super's options have
5785 // been updated.
5786 Sub.superOptions = Super.options;
5787 Sub.extendOptions = extendOptions;
5788 Sub.sealedOptions = extend({}, Sub.options);
5789 // cache constructor
5790 cachedCtors[SuperId] = Sub;
5791 return Sub;
5792 };
5793}
5794function initProps(Comp) {
5795 const props = Comp.options.props;
5796 for (const key in props) {
5797 proxy(Comp.prototype, `_props`, key);
5798 }
5799}
5800function initComputed(Comp) {
5801 const computed = Comp.options.computed;
5802 for (const key in computed) {
5803 defineComputed(Comp.prototype, key, computed[key]);
5804 }
5805}
5806
5807function initAssetRegisters(Vue) {
5808 /**
5809 * Create asset registration methods.
5810 */
5811 ASSET_TYPES.forEach(type => {
5812 // @ts-expect-error function is not exact same type
5813 Vue[type] = function (id, definition) {
5814 if (!definition) {
5815 return this.options[type + 's'][id];
5816 }
5817 else {
5818 /* istanbul ignore if */
5819 if (type === 'component') {
5820 validateComponentName(id);
5821 }
5822 if (type === 'component' && isPlainObject(definition)) {
5823 // @ts-expect-error
5824 definition.name = definition.name || id;
5825 definition = this.options._base.extend(definition);
5826 }
5827 if (type === 'directive' && isFunction(definition)) {
5828 definition = { bind: definition, update: definition };
5829 }
5830 this.options[type + 's'][id] = definition;
5831 return definition;
5832 }
5833 };
5834 });
5835}
5836
5837function _getComponentName(opts) {
5838 return opts && (getComponentName(opts.Ctor.options) || opts.tag);
5839}
5840function matches(pattern, name) {
5841 if (isArray(pattern)) {
5842 return pattern.indexOf(name) > -1;
5843 }
5844 else if (typeof pattern === 'string') {
5845 return pattern.split(',').indexOf(name) > -1;
5846 }
5847 else if (isRegExp(pattern)) {
5848 return pattern.test(name);
5849 }
5850 /* istanbul ignore next */
5851 return false;
5852}
5853function pruneCache(keepAliveInstance, filter) {
5854 const { cache, keys, _vnode } = keepAliveInstance;
5855 for (const key in cache) {
5856 const entry = cache[key];
5857 if (entry) {
5858 const name = entry.name;
5859 if (name && !filter(name)) {
5860 pruneCacheEntry(cache, key, keys, _vnode);
5861 }
5862 }
5863 }
5864}
5865function pruneCacheEntry(cache, key, keys, current) {
5866 const entry = cache[key];
5867 if (entry && (!current || entry.tag !== current.tag)) {
5868 // @ts-expect-error can be undefined
5869 entry.componentInstance.$destroy();
5870 }
5871 cache[key] = null;
5872 remove$2(keys, key);
5873}
5874const patternTypes = [String, RegExp, Array];
5875// TODO defineComponent
5876var KeepAlive = {
5877 name: 'keep-alive',
5878 abstract: true,
5879 props: {
5880 include: patternTypes,
5881 exclude: patternTypes,
5882 max: [String, Number]
5883 },
5884 methods: {
5885 cacheVNode() {
5886 const { cache, keys, vnodeToCache, keyToCache } = this;
5887 if (vnodeToCache) {
5888 const { tag, componentInstance, componentOptions } = vnodeToCache;
5889 cache[keyToCache] = {
5890 name: _getComponentName(componentOptions),
5891 tag,
5892 componentInstance
5893 };
5894 keys.push(keyToCache);
5895 // prune oldest entry
5896 if (this.max && keys.length > parseInt(this.max)) {
5897 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5898 }
5899 this.vnodeToCache = null;
5900 }
5901 }
5902 },
5903 created() {
5904 this.cache = Object.create(null);
5905 this.keys = [];
5906 },
5907 destroyed() {
5908 for (const key in this.cache) {
5909 pruneCacheEntry(this.cache, key, this.keys);
5910 }
5911 },
5912 mounted() {
5913 this.cacheVNode();
5914 this.$watch('include', val => {
5915 pruneCache(this, name => matches(val, name));
5916 });
5917 this.$watch('exclude', val => {
5918 pruneCache(this, name => !matches(val, name));
5919 });
5920 },
5921 updated() {
5922 this.cacheVNode();
5923 },
5924 render() {
5925 const slot = this.$slots.default;
5926 const vnode = getFirstComponentChild(slot);
5927 const componentOptions = vnode && vnode.componentOptions;
5928 if (componentOptions) {
5929 // check pattern
5930 const name = _getComponentName(componentOptions);
5931 const { include, exclude } = this;
5932 if (
5933 // not included
5934 (include && (!name || !matches(include, name))) ||
5935 // excluded
5936 (exclude && name && matches(exclude, name))) {
5937 return vnode;
5938 }
5939 const { cache, keys } = this;
5940 const key = vnode.key == null
5941 ? // same constructor may get registered as different local components
5942 // so cid alone is not enough (#3269)
5943 componentOptions.Ctor.cid +
5944 (componentOptions.tag ? `::${componentOptions.tag}` : '')
5945 : vnode.key;
5946 if (cache[key]) {
5947 vnode.componentInstance = cache[key].componentInstance;
5948 // make current key freshest
5949 remove$2(keys, key);
5950 keys.push(key);
5951 }
5952 else {
5953 // delay setting the cache until update
5954 this.vnodeToCache = vnode;
5955 this.keyToCache = key;
5956 }
5957 // @ts-expect-error can vnode.data can be undefined
5958 vnode.data.keepAlive = true;
5959 }
5960 return vnode || (slot && slot[0]);
5961 }
5962};
5963
5964var builtInComponents = {
5965 KeepAlive
5966};
5967
5968function initGlobalAPI(Vue) {
5969 // config
5970 const configDef = {};
5971 configDef.get = () => config;
5972 {
5973 configDef.set = () => {
5974 warn('Do not replace the Vue.config object, set individual fields instead.');
5975 };
5976 }
5977 Object.defineProperty(Vue, 'config', configDef);
5978 // exposed util methods.
5979 // NOTE: these are not considered part of the public API - avoid relying on
5980 // them unless you are aware of the risk.
5981 Vue.util = {
5982 warn,
5983 extend,
5984 mergeOptions,
5985 defineReactive
5986 };
5987 Vue.set = set;
5988 Vue.delete = del;
5989 Vue.nextTick = nextTick;
5990 // 2.6 explicit observable API
5991 Vue.observable = (obj) => {
5992 observe(obj);
5993 return obj;
5994 };
5995 Vue.options = Object.create(null);
5996 ASSET_TYPES.forEach(type => {
5997 Vue.options[type + 's'] = Object.create(null);
5998 });
5999 // this is used to identify the "base" constructor to extend all plain-object
6000 // components with in Weex's multi-instance scenarios.
6001 Vue.options._base = Vue;
6002 extend(Vue.options.components, builtInComponents);
6003 initUse(Vue);
6004 initMixin(Vue);
6005 initExtend(Vue);
6006 initAssetRegisters(Vue);
6007}
6008
6009initGlobalAPI(Vue);
6010Object.defineProperty(Vue.prototype, '$isServer', {
6011 get: isServerRendering
6012});
6013Object.defineProperty(Vue.prototype, '$ssrContext', {
6014 get() {
6015 /* istanbul ignore next */
6016 return this.$vnode && this.$vnode.ssrContext;
6017 }
6018});
6019// expose FunctionalRenderContext for ssr runtime helper installation
6020Object.defineProperty(Vue, 'FunctionalRenderContext', {
6021 value: FunctionalRenderContext
6022});
6023Vue.version = version;
6024
6025// these are reserved for web because they are directly compiled away
6026// during template compilation
6027const isReservedAttr = makeMap('style,class');
6028// attributes that should be using props for binding
6029const acceptValue = makeMap('input,textarea,option,select,progress');
6030const mustUseProp = (tag, type, attr) => {
6031 return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
6032 (attr === 'selected' && tag === 'option') ||
6033 (attr === 'checked' && tag === 'input') ||
6034 (attr === 'muted' && tag === 'video'));
6035};
6036const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
6037const isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
6038const convertEnumeratedValue = (key, value) => {
6039 return isFalsyAttrValue(value) || value === 'false'
6040 ? 'false'
6041 : // allow arbitrary string value for contenteditable
6042 key === 'contenteditable' && isValidContentEditableValue(value)
6043 ? value
6044 : 'true';
6045};
6046const isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
6047 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
6048 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
6049 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
6050 'required,reversed,scoped,seamless,selected,sortable,' +
6051 'truespeed,typemustmatch,visible');
6052const xlinkNS = 'http://www.w3.org/1999/xlink';
6053const isXlink = (name) => {
6054 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
6055};
6056const getXlinkProp = (name) => {
6057 return isXlink(name) ? name.slice(6, name.length) : '';
6058};
6059const isFalsyAttrValue = (val) => {
6060 return val == null || val === false;
6061};
6062
6063function genClassForVnode(vnode) {
6064 let data = vnode.data;
6065 let parentNode = vnode;
6066 let childNode = vnode;
6067 while (isDef(childNode.componentInstance)) {
6068 childNode = childNode.componentInstance._vnode;
6069 if (childNode && childNode.data) {
6070 data = mergeClassData(childNode.data, data);
6071 }
6072 }
6073 // @ts-expect-error parentNode.parent not VNodeWithData
6074 while (isDef((parentNode = parentNode.parent))) {
6075 if (parentNode && parentNode.data) {
6076 data = mergeClassData(data, parentNode.data);
6077 }
6078 }
6079 return renderClass(data.staticClass, data.class);
6080}
6081function mergeClassData(child, parent) {
6082 return {
6083 staticClass: concat(child.staticClass, parent.staticClass),
6084 class: isDef(child.class) ? [child.class, parent.class] : parent.class
6085 };
6086}
6087function renderClass(staticClass, dynamicClass) {
6088 if (isDef(staticClass) || isDef(dynamicClass)) {
6089 return concat(staticClass, stringifyClass(dynamicClass));
6090 }
6091 /* istanbul ignore next */
6092 return '';
6093}
6094function concat(a, b) {
6095 return a ? (b ? a + ' ' + b : a) : b || '';
6096}
6097function stringifyClass(value) {
6098 if (Array.isArray(value)) {
6099 return stringifyArray(value);
6100 }
6101 if (isObject(value)) {
6102 return stringifyObject(value);
6103 }
6104 if (typeof value === 'string') {
6105 return value;
6106 }
6107 /* istanbul ignore next */
6108 return '';
6109}
6110function stringifyArray(value) {
6111 let res = '';
6112 let stringified;
6113 for (let i = 0, l = value.length; i < l; i++) {
6114 if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
6115 if (res)
6116 res += ' ';
6117 res += stringified;
6118 }
6119 }
6120 return res;
6121}
6122function stringifyObject(value) {
6123 let res = '';
6124 for (const key in value) {
6125 if (value[key]) {
6126 if (res)
6127 res += ' ';
6128 res += key;
6129 }
6130 }
6131 return res;
6132}
6133
6134const namespaceMap = {
6135 svg: 'http://www.w3.org/2000/svg',
6136 math: 'http://www.w3.org/1998/Math/MathML'
6137};
6138const isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
6139 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
6140 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
6141 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
6142 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
6143 'embed,object,param,source,canvas,script,noscript,del,ins,' +
6144 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
6145 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
6146 'output,progress,select,textarea,' +
6147 'details,dialog,menu,menuitem,summary,' +
6148 'content,element,shadow,template,blockquote,iframe,tfoot');
6149// this map is intentionally selective, only covering SVG elements that may
6150// contain child elements.
6151const isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
6152 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
6153 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
6154const isReservedTag = (tag) => {
6155 return isHTMLTag(tag) || isSVG(tag);
6156};
6157function getTagNamespace(tag) {
6158 if (isSVG(tag)) {
6159 return 'svg';
6160 }
6161 // basic support for MathML
6162 // note it doesn't support other MathML elements being component roots
6163 if (tag === 'math') {
6164 return 'math';
6165 }
6166}
6167const unknownElementCache = Object.create(null);
6168function isUnknownElement(tag) {
6169 /* istanbul ignore if */
6170 if (!inBrowser) {
6171 return true;
6172 }
6173 if (isReservedTag(tag)) {
6174 return false;
6175 }
6176 tag = tag.toLowerCase();
6177 /* istanbul ignore if */
6178 if (unknownElementCache[tag] != null) {
6179 return unknownElementCache[tag];
6180 }
6181 const el = document.createElement(tag);
6182 if (tag.indexOf('-') > -1) {
6183 // https://stackoverflow.com/a/28210364/1070244
6184 return (unknownElementCache[tag] =
6185 el.constructor === window.HTMLUnknownElement ||
6186 el.constructor === window.HTMLElement);
6187 }
6188 else {
6189 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
6190 }
6191}
6192const isTextInputType = makeMap('text,number,password,search,email,tel,url');
6193
6194/**
6195 * Query an element selector if it's not an element already.
6196 */
6197function query(el) {
6198 if (typeof el === 'string') {
6199 const selected = document.querySelector(el);
6200 if (!selected) {
6201 warn('Cannot find element: ' + el);
6202 return document.createElement('div');
6203 }
6204 return selected;
6205 }
6206 else {
6207 return el;
6208 }
6209}
6210
6211function createElement(tagName, vnode) {
6212 const elm = document.createElement(tagName);
6213 if (tagName !== 'select') {
6214 return elm;
6215 }
6216 // false or null will remove the attribute but undefined will not
6217 if (vnode.data &&
6218 vnode.data.attrs &&
6219 vnode.data.attrs.multiple !== undefined) {
6220 elm.setAttribute('multiple', 'multiple');
6221 }
6222 return elm;
6223}
6224function createElementNS(namespace, tagName) {
6225 return document.createElementNS(namespaceMap[namespace], tagName);
6226}
6227function createTextNode(text) {
6228 return document.createTextNode(text);
6229}
6230function createComment(text) {
6231 return document.createComment(text);
6232}
6233function insertBefore(parentNode, newNode, referenceNode) {
6234 parentNode.insertBefore(newNode, referenceNode);
6235}
6236function removeChild(node, child) {
6237 node.removeChild(child);
6238}
6239function appendChild(node, child) {
6240 node.appendChild(child);
6241}
6242function parentNode(node) {
6243 return node.parentNode;
6244}
6245function nextSibling(node) {
6246 return node.nextSibling;
6247}
6248function tagName(node) {
6249 return node.tagName;
6250}
6251function setTextContent(node, text) {
6252 node.textContent = text;
6253}
6254function setStyleScope(node, scopeId) {
6255 node.setAttribute(scopeId, '');
6256}
6257
6258var nodeOps = /*#__PURE__*/Object.freeze({
6259 __proto__: null,
6260 createElement: createElement,
6261 createElementNS: createElementNS,
6262 createTextNode: createTextNode,
6263 createComment: createComment,
6264 insertBefore: insertBefore,
6265 removeChild: removeChild,
6266 appendChild: appendChild,
6267 parentNode: parentNode,
6268 nextSibling: nextSibling,
6269 tagName: tagName,
6270 setTextContent: setTextContent,
6271 setStyleScope: setStyleScope
6272});
6273
6274var ref = {
6275 create(_, vnode) {
6276 registerRef(vnode);
6277 },
6278 update(oldVnode, vnode) {
6279 if (oldVnode.data.ref !== vnode.data.ref) {
6280 registerRef(oldVnode, true);
6281 registerRef(vnode);
6282 }
6283 },
6284 destroy(vnode) {
6285 registerRef(vnode, true);
6286 }
6287};
6288function registerRef(vnode, isRemoval) {
6289 const ref = vnode.data.ref;
6290 if (!isDef(ref))
6291 return;
6292 const vm = vnode.context;
6293 const refValue = vnode.componentInstance || vnode.elm;
6294 const value = isRemoval ? null : refValue;
6295 const $refsValue = isRemoval ? undefined : refValue;
6296 if (isFunction(ref)) {
6297 invokeWithErrorHandling(ref, vm, [value], vm, `template ref function`);
6298 return;
6299 }
6300 const isFor = vnode.data.refInFor;
6301 const _isString = typeof ref === 'string' || typeof ref === 'number';
6302 const _isRef = isRef(ref);
6303 const refs = vm.$refs;
6304 if (_isString || _isRef) {
6305 if (isFor) {
6306 const existing = _isString ? refs[ref] : ref.value;
6307 if (isRemoval) {
6308 isArray(existing) && remove$2(existing, refValue);
6309 }
6310 else {
6311 if (!isArray(existing)) {
6312 if (_isString) {
6313 refs[ref] = [refValue];
6314 setSetupRef(vm, ref, refs[ref]);
6315 }
6316 else {
6317 ref.value = [refValue];
6318 }
6319 }
6320 else if (!existing.includes(refValue)) {
6321 existing.push(refValue);
6322 }
6323 }
6324 }
6325 else if (_isString) {
6326 if (isRemoval && refs[ref] !== refValue) {
6327 return;
6328 }
6329 refs[ref] = $refsValue;
6330 setSetupRef(vm, ref, value);
6331 }
6332 else if (_isRef) {
6333 if (isRemoval && ref.value !== refValue) {
6334 return;
6335 }
6336 ref.value = value;
6337 }
6338 else {
6339 warn(`Invalid template ref type: ${typeof ref}`);
6340 }
6341 }
6342}
6343function setSetupRef({ _setupState }, key, val) {
6344 if (_setupState && hasOwn(_setupState, key)) {
6345 if (isRef(_setupState[key])) {
6346 _setupState[key].value = val;
6347 }
6348 else {
6349 _setupState[key] = val;
6350 }
6351 }
6352}
6353
6354/**
6355 * Virtual DOM patching algorithm based on Snabbdom by
6356 * Simon Friis Vindum (@paldepind)
6357 * Licensed under the MIT License
6358 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
6359 *
6360 * modified by Evan You (@yyx990803)
6361 *
6362 * Not type-checking this because this file is perf-critical and the cost
6363 * of making flow understand it is not worth it.
6364 */
6365const emptyNode = new VNode('', {}, []);
6366const hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
6367function sameVnode(a, b) {
6368 return (a.key === b.key &&
6369 a.asyncFactory === b.asyncFactory &&
6370 ((a.tag === b.tag &&
6371 a.isComment === b.isComment &&
6372 isDef(a.data) === isDef(b.data) &&
6373 sameInputType(a, b)) ||
6374 (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
6375}
6376function sameInputType(a, b) {
6377 if (a.tag !== 'input')
6378 return true;
6379 let i;
6380 const typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
6381 const typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
6382 return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
6383}
6384function createKeyToOldIdx(children, beginIdx, endIdx) {
6385 let i, key;
6386 const map = {};
6387 for (i = beginIdx; i <= endIdx; ++i) {
6388 key = children[i].key;
6389 if (isDef(key))
6390 map[key] = i;
6391 }
6392 return map;
6393}
6394function createPatchFunction(backend) {
6395 let i, j;
6396 const cbs = {};
6397 const { modules, nodeOps } = backend;
6398 for (i = 0; i < hooks.length; ++i) {
6399 cbs[hooks[i]] = [];
6400 for (j = 0; j < modules.length; ++j) {
6401 if (isDef(modules[j][hooks[i]])) {
6402 cbs[hooks[i]].push(modules[j][hooks[i]]);
6403 }
6404 }
6405 }
6406 function emptyNodeAt(elm) {
6407 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
6408 }
6409 function createRmCb(childElm, listeners) {
6410 function remove() {
6411 if (--remove.listeners === 0) {
6412 removeNode(childElm);
6413 }
6414 }
6415 remove.listeners = listeners;
6416 return remove;
6417 }
6418 function removeNode(el) {
6419 const parent = nodeOps.parentNode(el);
6420 // element may have already been removed due to v-html / v-text
6421 if (isDef(parent)) {
6422 nodeOps.removeChild(parent, el);
6423 }
6424 }
6425 function isUnknownElement(vnode, inVPre) {
6426 return (!inVPre &&
6427 !vnode.ns &&
6428 !(config.ignoredElements.length &&
6429 config.ignoredElements.some(ignore => {
6430 return isRegExp(ignore)
6431 ? ignore.test(vnode.tag)
6432 : ignore === vnode.tag;
6433 })) &&
6434 config.isUnknownElement(vnode.tag));
6435 }
6436 let creatingElmInVPre = 0;
6437 function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
6438 if (isDef(vnode.elm) && isDef(ownerArray)) {
6439 // This vnode was used in a previous render!
6440 // now it's used as a new node, overwriting its elm would cause
6441 // potential patch errors down the road when it's used as an insertion
6442 // reference node. Instead, we clone the node on-demand before creating
6443 // associated DOM element for it.
6444 vnode = ownerArray[index] = cloneVNode(vnode);
6445 }
6446 vnode.isRootInsert = !nested; // for transition enter check
6447 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
6448 return;
6449 }
6450 const data = vnode.data;
6451 const children = vnode.children;
6452 const tag = vnode.tag;
6453 if (isDef(tag)) {
6454 {
6455 if (data && data.pre) {
6456 creatingElmInVPre++;
6457 }
6458 if (isUnknownElement(vnode, creatingElmInVPre)) {
6459 warn('Unknown custom element: <' +
6460 tag +
6461 '> - did you ' +
6462 'register the component correctly? For recursive components, ' +
6463 'make sure to provide the "name" option.', vnode.context);
6464 }
6465 }
6466 vnode.elm = vnode.ns
6467 ? nodeOps.createElementNS(vnode.ns, tag)
6468 : nodeOps.createElement(tag, vnode);
6469 setScope(vnode);
6470 createChildren(vnode, children, insertedVnodeQueue);
6471 if (isDef(data)) {
6472 invokeCreateHooks(vnode, insertedVnodeQueue);
6473 }
6474 insert(parentElm, vnode.elm, refElm);
6475 if (data && data.pre) {
6476 creatingElmInVPre--;
6477 }
6478 }
6479 else if (isTrue(vnode.isComment)) {
6480 vnode.elm = nodeOps.createComment(vnode.text);
6481 insert(parentElm, vnode.elm, refElm);
6482 }
6483 else {
6484 vnode.elm = nodeOps.createTextNode(vnode.text);
6485 insert(parentElm, vnode.elm, refElm);
6486 }
6487 }
6488 function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6489 let i = vnode.data;
6490 if (isDef(i)) {
6491 const isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
6492 if (isDef((i = i.hook)) && isDef((i = i.init))) {
6493 i(vnode, false /* hydrating */);
6494 }
6495 // after calling the init hook, if the vnode is a child component
6496 // it should've created a child instance and mounted it. the child
6497 // component also has set the placeholder vnode's elm.
6498 // in that case we can just return the element and be done.
6499 if (isDef(vnode.componentInstance)) {
6500 initComponent(vnode, insertedVnodeQueue);
6501 insert(parentElm, vnode.elm, refElm);
6502 if (isTrue(isReactivated)) {
6503 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
6504 }
6505 return true;
6506 }
6507 }
6508 }
6509 function initComponent(vnode, insertedVnodeQueue) {
6510 if (isDef(vnode.data.pendingInsert)) {
6511 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
6512 vnode.data.pendingInsert = null;
6513 }
6514 vnode.elm = vnode.componentInstance.$el;
6515 if (isPatchable(vnode)) {
6516 invokeCreateHooks(vnode, insertedVnodeQueue);
6517 setScope(vnode);
6518 }
6519 else {
6520 // empty component root.
6521 // skip all element-related modules except for ref (#3455)
6522 registerRef(vnode);
6523 // make sure to invoke the insert hook
6524 insertedVnodeQueue.push(vnode);
6525 }
6526 }
6527 function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6528 let i;
6529 // hack for #4339: a reactivated component with inner transition
6530 // does not trigger because the inner node's created hooks are not called
6531 // again. It's not ideal to involve module-specific logic in here but
6532 // there doesn't seem to be a better way to do it.
6533 let innerNode = vnode;
6534 while (innerNode.componentInstance) {
6535 innerNode = innerNode.componentInstance._vnode;
6536 if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
6537 for (i = 0; i < cbs.activate.length; ++i) {
6538 cbs.activate[i](emptyNode, innerNode);
6539 }
6540 insertedVnodeQueue.push(innerNode);
6541 break;
6542 }
6543 }
6544 // unlike a newly created component,
6545 // a reactivated keep-alive component doesn't insert itself
6546 insert(parentElm, vnode.elm, refElm);
6547 }
6548 function insert(parent, elm, ref) {
6549 if (isDef(parent)) {
6550 if (isDef(ref)) {
6551 if (nodeOps.parentNode(ref) === parent) {
6552 nodeOps.insertBefore(parent, elm, ref);
6553 }
6554 }
6555 else {
6556 nodeOps.appendChild(parent, elm);
6557 }
6558 }
6559 }
6560 function createChildren(vnode, children, insertedVnodeQueue) {
6561 if (isArray(children)) {
6562 {
6563 checkDuplicateKeys(children);
6564 }
6565 for (let i = 0; i < children.length; ++i) {
6566 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6567 }
6568 }
6569 else if (isPrimitive(vnode.text)) {
6570 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6571 }
6572 }
6573 function isPatchable(vnode) {
6574 while (vnode.componentInstance) {
6575 vnode = vnode.componentInstance._vnode;
6576 }
6577 return isDef(vnode.tag);
6578 }
6579 function invokeCreateHooks(vnode, insertedVnodeQueue) {
6580 for (let i = 0; i < cbs.create.length; ++i) {
6581 cbs.create[i](emptyNode, vnode);
6582 }
6583 i = vnode.data.hook; // Reuse variable
6584 if (isDef(i)) {
6585 if (isDef(i.create))
6586 i.create(emptyNode, vnode);
6587 if (isDef(i.insert))
6588 insertedVnodeQueue.push(vnode);
6589 }
6590 }
6591 // set scope id attribute for scoped CSS.
6592 // this is implemented as a special case to avoid the overhead
6593 // of going through the normal attribute patching process.
6594 function setScope(vnode) {
6595 let i;
6596 if (isDef((i = vnode.fnScopeId))) {
6597 nodeOps.setStyleScope(vnode.elm, i);
6598 }
6599 else {
6600 let ancestor = vnode;
6601 while (ancestor) {
6602 if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
6603 nodeOps.setStyleScope(vnode.elm, i);
6604 }
6605 ancestor = ancestor.parent;
6606 }
6607 }
6608 // for slot content they should also get the scopeId from the host instance.
6609 if (isDef((i = activeInstance)) &&
6610 i !== vnode.context &&
6611 i !== vnode.fnContext &&
6612 isDef((i = i.$options._scopeId))) {
6613 nodeOps.setStyleScope(vnode.elm, i);
6614 }
6615 }
6616 function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6617 for (; startIdx <= endIdx; ++startIdx) {
6618 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6619 }
6620 }
6621 function invokeDestroyHook(vnode) {
6622 let i, j;
6623 const data = vnode.data;
6624 if (isDef(data)) {
6625 if (isDef((i = data.hook)) && isDef((i = i.destroy)))
6626 i(vnode);
6627 for (i = 0; i < cbs.destroy.length; ++i)
6628 cbs.destroy[i](vnode);
6629 }
6630 if (isDef((i = vnode.children))) {
6631 for (j = 0; j < vnode.children.length; ++j) {
6632 invokeDestroyHook(vnode.children[j]);
6633 }
6634 }
6635 }
6636 function removeVnodes(vnodes, startIdx, endIdx) {
6637 for (; startIdx <= endIdx; ++startIdx) {
6638 const ch = vnodes[startIdx];
6639 if (isDef(ch)) {
6640 if (isDef(ch.tag)) {
6641 removeAndInvokeRemoveHook(ch);
6642 invokeDestroyHook(ch);
6643 }
6644 else {
6645 // Text node
6646 removeNode(ch.elm);
6647 }
6648 }
6649 }
6650 }
6651 function removeAndInvokeRemoveHook(vnode, rm) {
6652 if (isDef(rm) || isDef(vnode.data)) {
6653 let i;
6654 const listeners = cbs.remove.length + 1;
6655 if (isDef(rm)) {
6656 // we have a recursively passed down rm callback
6657 // increase the listeners count
6658 rm.listeners += listeners;
6659 }
6660 else {
6661 // directly removing
6662 rm = createRmCb(vnode.elm, listeners);
6663 }
6664 // recursively invoke hooks on child component root node
6665 if (isDef((i = vnode.componentInstance)) &&
6666 isDef((i = i._vnode)) &&
6667 isDef(i.data)) {
6668 removeAndInvokeRemoveHook(i, rm);
6669 }
6670 for (i = 0; i < cbs.remove.length; ++i) {
6671 cbs.remove[i](vnode, rm);
6672 }
6673 if (isDef((i = vnode.data.hook)) && isDef((i = i.remove))) {
6674 i(vnode, rm);
6675 }
6676 else {
6677 rm();
6678 }
6679 }
6680 else {
6681 removeNode(vnode.elm);
6682 }
6683 }
6684 function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6685 let oldStartIdx = 0;
6686 let newStartIdx = 0;
6687 let oldEndIdx = oldCh.length - 1;
6688 let oldStartVnode = oldCh[0];
6689 let oldEndVnode = oldCh[oldEndIdx];
6690 let newEndIdx = newCh.length - 1;
6691 let newStartVnode = newCh[0];
6692 let newEndVnode = newCh[newEndIdx];
6693 let oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6694 // removeOnly is a special flag used only by <transition-group>
6695 // to ensure removed elements stay in correct relative positions
6696 // during leaving transitions
6697 const canMove = !removeOnly;
6698 {
6699 checkDuplicateKeys(newCh);
6700 }
6701 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6702 if (isUndef(oldStartVnode)) {
6703 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6704 }
6705 else if (isUndef(oldEndVnode)) {
6706 oldEndVnode = oldCh[--oldEndIdx];
6707 }
6708 else if (sameVnode(oldStartVnode, newStartVnode)) {
6709 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6710 oldStartVnode = oldCh[++oldStartIdx];
6711 newStartVnode = newCh[++newStartIdx];
6712 }
6713 else if (sameVnode(oldEndVnode, newEndVnode)) {
6714 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6715 oldEndVnode = oldCh[--oldEndIdx];
6716 newEndVnode = newCh[--newEndIdx];
6717 }
6718 else if (sameVnode(oldStartVnode, newEndVnode)) {
6719 // Vnode moved right
6720 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6721 canMove &&
6722 nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6723 oldStartVnode = oldCh[++oldStartIdx];
6724 newEndVnode = newCh[--newEndIdx];
6725 }
6726 else if (sameVnode(oldEndVnode, newStartVnode)) {
6727 // Vnode moved left
6728 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6729 canMove &&
6730 nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6731 oldEndVnode = oldCh[--oldEndIdx];
6732 newStartVnode = newCh[++newStartIdx];
6733 }
6734 else {
6735 if (isUndef(oldKeyToIdx))
6736 oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
6737 idxInOld = isDef(newStartVnode.key)
6738 ? oldKeyToIdx[newStartVnode.key]
6739 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6740 if (isUndef(idxInOld)) {
6741 // New element
6742 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6743 }
6744 else {
6745 vnodeToMove = oldCh[idxInOld];
6746 if (sameVnode(vnodeToMove, newStartVnode)) {
6747 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6748 oldCh[idxInOld] = undefined;
6749 canMove &&
6750 nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6751 }
6752 else {
6753 // same key but different element. treat as new element
6754 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6755 }
6756 }
6757 newStartVnode = newCh[++newStartIdx];
6758 }
6759 }
6760 if (oldStartIdx > oldEndIdx) {
6761 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6762 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6763 }
6764 else if (newStartIdx > newEndIdx) {
6765 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6766 }
6767 }
6768 function checkDuplicateKeys(children) {
6769 const seenKeys = {};
6770 for (let i = 0; i < children.length; i++) {
6771 const vnode = children[i];
6772 const key = vnode.key;
6773 if (isDef(key)) {
6774 if (seenKeys[key]) {
6775 warn(`Duplicate keys detected: '${key}'. This may cause an update error.`, vnode.context);
6776 }
6777 else {
6778 seenKeys[key] = true;
6779 }
6780 }
6781 }
6782 }
6783 function findIdxInOld(node, oldCh, start, end) {
6784 for (let i = start; i < end; i++) {
6785 const c = oldCh[i];
6786 if (isDef(c) && sameVnode(node, c))
6787 return i;
6788 }
6789 }
6790 function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
6791 if (oldVnode === vnode) {
6792 return;
6793 }
6794 if (isDef(vnode.elm) && isDef(ownerArray)) {
6795 // clone reused vnode
6796 vnode = ownerArray[index] = cloneVNode(vnode);
6797 }
6798 const elm = (vnode.elm = oldVnode.elm);
6799 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6800 if (isDef(vnode.asyncFactory.resolved)) {
6801 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6802 }
6803 else {
6804 vnode.isAsyncPlaceholder = true;
6805 }
6806 return;
6807 }
6808 // reuse element for static trees.
6809 // note we only do this if the vnode is cloned -
6810 // if the new node is not cloned it means the render functions have been
6811 // reset by the hot-reload-api and we need to do a proper re-render.
6812 if (isTrue(vnode.isStatic) &&
6813 isTrue(oldVnode.isStatic) &&
6814 vnode.key === oldVnode.key &&
6815 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
6816 vnode.componentInstance = oldVnode.componentInstance;
6817 return;
6818 }
6819 let i;
6820 const data = vnode.data;
6821 if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
6822 i(oldVnode, vnode);
6823 }
6824 const oldCh = oldVnode.children;
6825 const ch = vnode.children;
6826 if (isDef(data) && isPatchable(vnode)) {
6827 for (i = 0; i < cbs.update.length; ++i)
6828 cbs.update[i](oldVnode, vnode);
6829 if (isDef((i = data.hook)) && isDef((i = i.update)))
6830 i(oldVnode, vnode);
6831 }
6832 if (isUndef(vnode.text)) {
6833 if (isDef(oldCh) && isDef(ch)) {
6834 if (oldCh !== ch)
6835 updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
6836 }
6837 else if (isDef(ch)) {
6838 {
6839 checkDuplicateKeys(ch);
6840 }
6841 if (isDef(oldVnode.text))
6842 nodeOps.setTextContent(elm, '');
6843 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6844 }
6845 else if (isDef(oldCh)) {
6846 removeVnodes(oldCh, 0, oldCh.length - 1);
6847 }
6848 else if (isDef(oldVnode.text)) {
6849 nodeOps.setTextContent(elm, '');
6850 }
6851 }
6852 else if (oldVnode.text !== vnode.text) {
6853 nodeOps.setTextContent(elm, vnode.text);
6854 }
6855 if (isDef(data)) {
6856 if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
6857 i(oldVnode, vnode);
6858 }
6859 }
6860 function invokeInsertHook(vnode, queue, initial) {
6861 // delay insert hooks for component root nodes, invoke them after the
6862 // element is really inserted
6863 if (isTrue(initial) && isDef(vnode.parent)) {
6864 vnode.parent.data.pendingInsert = queue;
6865 }
6866 else {
6867 for (let i = 0; i < queue.length; ++i) {
6868 queue[i].data.hook.insert(queue[i]);
6869 }
6870 }
6871 }
6872 let hydrationBailed = false;
6873 // list of modules that can skip create hook during hydration because they
6874 // are already rendered on the client or has no need for initialization
6875 // Note: style is excluded because it relies on initial clone for future
6876 // deep updates (#7063).
6877 const isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6878 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6879 function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
6880 let i;
6881 const { tag, data, children } = vnode;
6882 inVPre = inVPre || (data && data.pre);
6883 vnode.elm = elm;
6884 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6885 vnode.isAsyncPlaceholder = true;
6886 return true;
6887 }
6888 // assert node match
6889 {
6890 if (!assertNodeMatch(elm, vnode, inVPre)) {
6891 return false;
6892 }
6893 }
6894 if (isDef(data)) {
6895 if (isDef((i = data.hook)) && isDef((i = i.init)))
6896 i(vnode, true /* hydrating */);
6897 if (isDef((i = vnode.componentInstance))) {
6898 // child component. it should have hydrated its own tree.
6899 initComponent(vnode, insertedVnodeQueue);
6900 return true;
6901 }
6902 }
6903 if (isDef(tag)) {
6904 if (isDef(children)) {
6905 // empty element, allow client to pick up and populate children
6906 if (!elm.hasChildNodes()) {
6907 createChildren(vnode, children, insertedVnodeQueue);
6908 }
6909 else {
6910 // v-html and domProps: innerHTML
6911 if (isDef((i = data)) &&
6912 isDef((i = i.domProps)) &&
6913 isDef((i = i.innerHTML))) {
6914 if (i !== elm.innerHTML) {
6915 /* istanbul ignore if */
6916 if (typeof console !== 'undefined' &&
6917 !hydrationBailed) {
6918 hydrationBailed = true;
6919 console.warn('Parent: ', elm);
6920 console.warn('server innerHTML: ', i);
6921 console.warn('client innerHTML: ', elm.innerHTML);
6922 }
6923 return false;
6924 }
6925 }
6926 else {
6927 // iterate and compare children lists
6928 let childrenMatch = true;
6929 let childNode = elm.firstChild;
6930 for (let i = 0; i < children.length; i++) {
6931 if (!childNode ||
6932 !hydrate(childNode, children[i], insertedVnodeQueue, inVPre)) {
6933 childrenMatch = false;
6934 break;
6935 }
6936 childNode = childNode.nextSibling;
6937 }
6938 // if childNode is not null, it means the actual childNodes list is
6939 // longer than the virtual children list.
6940 if (!childrenMatch || childNode) {
6941 /* istanbul ignore if */
6942 if (typeof console !== 'undefined' &&
6943 !hydrationBailed) {
6944 hydrationBailed = true;
6945 console.warn('Parent: ', elm);
6946 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6947 }
6948 return false;
6949 }
6950 }
6951 }
6952 }
6953 if (isDef(data)) {
6954 let fullInvoke = false;
6955 for (const key in data) {
6956 if (!isRenderedModule(key)) {
6957 fullInvoke = true;
6958 invokeCreateHooks(vnode, insertedVnodeQueue);
6959 break;
6960 }
6961 }
6962 if (!fullInvoke && data['class']) {
6963 // ensure collecting deps for deep class bindings for future updates
6964 traverse(data['class']);
6965 }
6966 }
6967 }
6968 else if (elm.data !== vnode.text) {
6969 elm.data = vnode.text;
6970 }
6971 return true;
6972 }
6973 function assertNodeMatch(node, vnode, inVPre) {
6974 if (isDef(vnode.tag)) {
6975 return (vnode.tag.indexOf('vue-component') === 0 ||
6976 (!isUnknownElement(vnode, inVPre) &&
6977 vnode.tag.toLowerCase() ===
6978 (node.tagName && node.tagName.toLowerCase())));
6979 }
6980 else {
6981 return node.nodeType === (vnode.isComment ? 8 : 3);
6982 }
6983 }
6984 return function patch(oldVnode, vnode, hydrating, removeOnly) {
6985 if (isUndef(vnode)) {
6986 if (isDef(oldVnode))
6987 invokeDestroyHook(oldVnode);
6988 return;
6989 }
6990 let isInitialPatch = false;
6991 const insertedVnodeQueue = [];
6992 if (isUndef(oldVnode)) {
6993 // empty mount (likely as component), create new root element
6994 isInitialPatch = true;
6995 createElm(vnode, insertedVnodeQueue);
6996 }
6997 else {
6998 const isRealElement = isDef(oldVnode.nodeType);
6999 if (!isRealElement && sameVnode(oldVnode, vnode)) {
7000 // patch existing root node
7001 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
7002 }
7003 else {
7004 if (isRealElement) {
7005 // mounting to a real element
7006 // check if this is server-rendered content and if we can perform
7007 // a successful hydration.
7008 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
7009 oldVnode.removeAttribute(SSR_ATTR);
7010 hydrating = true;
7011 }
7012 if (isTrue(hydrating)) {
7013 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
7014 invokeInsertHook(vnode, insertedVnodeQueue, true);
7015 return oldVnode;
7016 }
7017 else {
7018 warn('The client-side rendered virtual DOM tree is not matching ' +
7019 'server-rendered content. This is likely caused by incorrect ' +
7020 'HTML markup, for example nesting block-level elements inside ' +
7021 '<p>, or missing <tbody>. Bailing hydration and performing ' +
7022 'full client-side render.');
7023 }
7024 }
7025 // either not server-rendered, or hydration failed.
7026 // create an empty node and replace it
7027 oldVnode = emptyNodeAt(oldVnode);
7028 }
7029 // replacing existing element
7030 const oldElm = oldVnode.elm;
7031 const parentElm = nodeOps.parentNode(oldElm);
7032 // create new node
7033 createElm(vnode, insertedVnodeQueue,
7034 // extremely rare edge case: do not insert if old element is in a
7035 // leaving transition. Only happens when combining transition +
7036 // keep-alive + HOCs. (#4590)
7037 oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
7038 // update parent placeholder node element, recursively
7039 if (isDef(vnode.parent)) {
7040 let ancestor = vnode.parent;
7041 const patchable = isPatchable(vnode);
7042 while (ancestor) {
7043 for (let i = 0; i < cbs.destroy.length; ++i) {
7044 cbs.destroy[i](ancestor);
7045 }
7046 ancestor.elm = vnode.elm;
7047 if (patchable) {
7048 for (let i = 0; i < cbs.create.length; ++i) {
7049 cbs.create[i](emptyNode, ancestor);
7050 }
7051 // #6513
7052 // invoke insert hooks that may have been merged by create hooks.
7053 // e.g. for directives that uses the "inserted" hook.
7054 const insert = ancestor.data.hook.insert;
7055 if (insert.merged) {
7056 // start at index 1 to avoid re-invoking component mounted hook
7057 // clone insert hooks to avoid being mutated during iteration.
7058 // e.g. for customed directives under transition group.
7059 const cloned = insert.fns.slice(1);
7060 for (let i = 0; i < cloned.length; i++) {
7061 cloned[i]();
7062 }
7063 }
7064 }
7065 else {
7066 registerRef(ancestor);
7067 }
7068 ancestor = ancestor.parent;
7069 }
7070 }
7071 // destroy old node
7072 if (isDef(parentElm)) {
7073 removeVnodes([oldVnode], 0, 0);
7074 }
7075 else if (isDef(oldVnode.tag)) {
7076 invokeDestroyHook(oldVnode);
7077 }
7078 }
7079 }
7080 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
7081 return vnode.elm;
7082 };
7083}
7084
7085var directives = {
7086 create: updateDirectives,
7087 update: updateDirectives,
7088 destroy: function unbindDirectives(vnode) {
7089 // @ts-expect-error emptyNode is not VNodeWithData
7090 updateDirectives(vnode, emptyNode);
7091 }
7092};
7093function updateDirectives(oldVnode, vnode) {
7094 if (oldVnode.data.directives || vnode.data.directives) {
7095 _update(oldVnode, vnode);
7096 }
7097}
7098function _update(oldVnode, vnode) {
7099 const isCreate = oldVnode === emptyNode;
7100 const isDestroy = vnode === emptyNode;
7101 const oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
7102 const newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
7103 const dirsWithInsert = [];
7104 const dirsWithPostpatch = [];
7105 let key, oldDir, dir;
7106 for (key in newDirs) {
7107 oldDir = oldDirs[key];
7108 dir = newDirs[key];
7109 if (!oldDir) {
7110 // new directive, bind
7111 callHook(dir, 'bind', vnode, oldVnode);
7112 if (dir.def && dir.def.inserted) {
7113 dirsWithInsert.push(dir);
7114 }
7115 }
7116 else {
7117 // existing directive, update
7118 dir.oldValue = oldDir.value;
7119 dir.oldArg = oldDir.arg;
7120 callHook(dir, 'update', vnode, oldVnode);
7121 if (dir.def && dir.def.componentUpdated) {
7122 dirsWithPostpatch.push(dir);
7123 }
7124 }
7125 }
7126 if (dirsWithInsert.length) {
7127 const callInsert = () => {
7128 for (let i = 0; i < dirsWithInsert.length; i++) {
7129 callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
7130 }
7131 };
7132 if (isCreate) {
7133 mergeVNodeHook(vnode, 'insert', callInsert);
7134 }
7135 else {
7136 callInsert();
7137 }
7138 }
7139 if (dirsWithPostpatch.length) {
7140 mergeVNodeHook(vnode, 'postpatch', () => {
7141 for (let i = 0; i < dirsWithPostpatch.length; i++) {
7142 callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
7143 }
7144 });
7145 }
7146 if (!isCreate) {
7147 for (key in oldDirs) {
7148 if (!newDirs[key]) {
7149 // no longer present, unbind
7150 callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
7151 }
7152 }
7153 }
7154}
7155const emptyModifiers = Object.create(null);
7156function normalizeDirectives(dirs, vm) {
7157 const res = Object.create(null);
7158 if (!dirs) {
7159 // $flow-disable-line
7160 return res;
7161 }
7162 let i, dir;
7163 for (i = 0; i < dirs.length; i++) {
7164 dir = dirs[i];
7165 if (!dir.modifiers) {
7166 // $flow-disable-line
7167 dir.modifiers = emptyModifiers;
7168 }
7169 res[getRawDirName(dir)] = dir;
7170 if (vm._setupState && vm._setupState.__sfc) {
7171 const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
7172 if (typeof setupDef === 'function') {
7173 dir.def = {
7174 bind: setupDef,
7175 update: setupDef,
7176 };
7177 }
7178 else {
7179 dir.def = setupDef;
7180 }
7181 }
7182 dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
7183 }
7184 // $flow-disable-line
7185 return res;
7186}
7187function getRawDirName(dir) {
7188 return (dir.rawName || `${dir.name}.${Object.keys(dir.modifiers || {}).join('.')}`);
7189}
7190function callHook(dir, hook, vnode, oldVnode, isDestroy) {
7191 const fn = dir.def && dir.def[hook];
7192 if (fn) {
7193 try {
7194 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
7195 }
7196 catch (e) {
7197 handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`);
7198 }
7199 }
7200}
7201
7202var baseModules = [ref, directives];
7203
7204function updateAttrs(oldVnode, vnode) {
7205 const opts = vnode.componentOptions;
7206 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
7207 return;
7208 }
7209 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
7210 return;
7211 }
7212 let key, cur, old;
7213 const elm = vnode.elm;
7214 const oldAttrs = oldVnode.data.attrs || {};
7215 let attrs = vnode.data.attrs || {};
7216 // clone observed objects, as the user probably wants to mutate it
7217 if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
7218 attrs = vnode.data.attrs = extend({}, attrs);
7219 }
7220 for (key in attrs) {
7221 cur = attrs[key];
7222 old = oldAttrs[key];
7223 if (old !== cur) {
7224 setAttr(elm, key, cur, vnode.data.pre);
7225 }
7226 }
7227 // #4391: in IE9, setting type can reset value for input[type=radio]
7228 // #6666: IE/Edge forces progress value down to 1 before setting a max
7229 /* istanbul ignore if */
7230 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
7231 setAttr(elm, 'value', attrs.value);
7232 }
7233 for (key in oldAttrs) {
7234 if (isUndef(attrs[key])) {
7235 if (isXlink(key)) {
7236 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
7237 }
7238 else if (!isEnumeratedAttr(key)) {
7239 elm.removeAttribute(key);
7240 }
7241 }
7242 }
7243}
7244function setAttr(el, key, value, isInPre) {
7245 if (isInPre || el.tagName.indexOf('-') > -1) {
7246 baseSetAttr(el, key, value);
7247 }
7248 else if (isBooleanAttr(key)) {
7249 // set attribute for blank value
7250 // e.g. <option disabled>Select one</option>
7251 if (isFalsyAttrValue(value)) {
7252 el.removeAttribute(key);
7253 }
7254 else {
7255 // technically allowfullscreen is a boolean attribute for <iframe>,
7256 // but Flash expects a value of "true" when used on <embed> tag
7257 value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
7258 el.setAttribute(key, value);
7259 }
7260 }
7261 else if (isEnumeratedAttr(key)) {
7262 el.setAttribute(key, convertEnumeratedValue(key, value));
7263 }
7264 else if (isXlink(key)) {
7265 if (isFalsyAttrValue(value)) {
7266 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
7267 }
7268 else {
7269 el.setAttributeNS(xlinkNS, key, value);
7270 }
7271 }
7272 else {
7273 baseSetAttr(el, key, value);
7274 }
7275}
7276function baseSetAttr(el, key, value) {
7277 if (isFalsyAttrValue(value)) {
7278 el.removeAttribute(key);
7279 }
7280 else {
7281 // #7138: IE10 & 11 fires input event when setting placeholder on
7282 // <textarea>... block the first input event and remove the blocker
7283 // immediately.
7284 /* istanbul ignore if */
7285 if (isIE &&
7286 !isIE9 &&
7287 el.tagName === 'TEXTAREA' &&
7288 key === 'placeholder' &&
7289 value !== '' &&
7290 !el.__ieph) {
7291 const blocker = e => {
7292 e.stopImmediatePropagation();
7293 el.removeEventListener('input', blocker);
7294 };
7295 el.addEventListener('input', blocker);
7296 // $flow-disable-line
7297 el.__ieph = true; /* IE placeholder patched */
7298 }
7299 el.setAttribute(key, value);
7300 }
7301}
7302var attrs = {
7303 create: updateAttrs,
7304 update: updateAttrs
7305};
7306
7307function updateClass(oldVnode, vnode) {
7308 const el = vnode.elm;
7309 const data = vnode.data;
7310 const oldData = oldVnode.data;
7311 if (isUndef(data.staticClass) &&
7312 isUndef(data.class) &&
7313 (isUndef(oldData) ||
7314 (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
7315 return;
7316 }
7317 let cls = genClassForVnode(vnode);
7318 // handle transition classes
7319 const transitionClass = el._transitionClasses;
7320 if (isDef(transitionClass)) {
7321 cls = concat(cls, stringifyClass(transitionClass));
7322 }
7323 // set the class
7324 if (cls !== el._prevClass) {
7325 el.setAttribute('class', cls);
7326 el._prevClass = cls;
7327 }
7328}
7329var klass = {
7330 create: updateClass,
7331 update: updateClass
7332};
7333
7334// in some cases, the event used has to be determined at runtime
7335// so we used some reserved tokens during compile.
7336const RANGE_TOKEN = '__r';
7337const CHECKBOX_RADIO_TOKEN = '__c';
7338
7339// normalize v-model event tokens that can only be determined at runtime.
7340// it's important to place the event as the first in the array because
7341// the whole point is ensuring the v-model callback gets called before
7342// user-attached handlers.
7343function normalizeEvents(on) {
7344 /* istanbul ignore if */
7345 if (isDef(on[RANGE_TOKEN])) {
7346 // IE input[type=range] only supports `change` event
7347 const event = isIE ? 'change' : 'input';
7348 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
7349 delete on[RANGE_TOKEN];
7350 }
7351 // This was originally intended to fix #4521 but no longer necessary
7352 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7353 /* istanbul ignore if */
7354 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7355 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7356 delete on[CHECKBOX_RADIO_TOKEN];
7357 }
7358}
7359let target;
7360function createOnceHandler(event, handler, capture) {
7361 const _target = target; // save current target element in closure
7362 return function onceHandler() {
7363 const res = handler.apply(null, arguments);
7364 if (res !== null) {
7365 remove(event, onceHandler, capture, _target);
7366 }
7367 };
7368}
7369// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
7370// implementation and does not fire microtasks in between event propagation, so
7371// safe to exclude.
7372const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
7373function add(name, handler, capture, passive) {
7374 // async edge case #6566: inner click event triggers patch, event handler
7375 // attached to outer element during patch, and triggered again. This
7376 // happens because browsers fire microtask ticks between event propagation.
7377 // the solution is simple: we save the timestamp when a handler is attached,
7378 // and the handler would only fire if the event passed to it was fired
7379 // AFTER it was attached.
7380 if (useMicrotaskFix) {
7381 const attachedTimestamp = currentFlushTimestamp;
7382 const original = handler;
7383 //@ts-expect-error
7384 handler = original._wrapper = function (e) {
7385 if (
7386 // no bubbling, should always fire.
7387 // this is just a safety net in case event.timeStamp is unreliable in
7388 // certain weird environments...
7389 e.target === e.currentTarget ||
7390 // event is fired after handler attachment
7391 e.timeStamp >= attachedTimestamp ||
7392 // bail for environments that have buggy event.timeStamp implementations
7393 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7394 // #9681 QtWebEngine event.timeStamp is negative value
7395 e.timeStamp <= 0 ||
7396 // #9448 bail if event is fired in another document in a multi-page
7397 // electron/nw.js app, since event.timeStamp will be using a different
7398 // starting reference
7399 e.target.ownerDocument !== document) {
7400 return original.apply(this, arguments);
7401 }
7402 };
7403 }
7404 target.addEventListener(name, handler, supportsPassive ? { capture, passive } : capture);
7405}
7406function remove(name, handler, capture, _target) {
7407 (_target || target).removeEventListener(name,
7408 //@ts-expect-error
7409 handler._wrapper || handler, capture);
7410}
7411function updateDOMListeners(oldVnode, vnode) {
7412 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
7413 return;
7414 }
7415 const on = vnode.data.on || {};
7416 const oldOn = oldVnode.data.on || {};
7417 // vnode is empty when removing all listeners,
7418 // and use old vnode dom element
7419 target = vnode.elm || oldVnode.elm;
7420 normalizeEvents(on);
7421 updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
7422 target = undefined;
7423}
7424var events = {
7425 create: updateDOMListeners,
7426 update: updateDOMListeners,
7427 // @ts-expect-error emptyNode has actually data
7428 destroy: (vnode) => updateDOMListeners(vnode, emptyNode)
7429};
7430
7431let svgContainer;
7432function updateDOMProps(oldVnode, vnode) {
7433 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
7434 return;
7435 }
7436 let key, cur;
7437 const elm = vnode.elm;
7438 const oldProps = oldVnode.data.domProps || {};
7439 let props = vnode.data.domProps || {};
7440 // clone observed objects, as the user probably wants to mutate it
7441 if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
7442 props = vnode.data.domProps = extend({}, props);
7443 }
7444 for (key in oldProps) {
7445 if (!(key in props)) {
7446 elm[key] = '';
7447 }
7448 }
7449 for (key in props) {
7450 cur = props[key];
7451 // ignore children if the node has textContent or innerHTML,
7452 // as these will throw away existing DOM nodes and cause removal errors
7453 // on subsequent patches (#3360)
7454 if (key === 'textContent' || key === 'innerHTML') {
7455 if (vnode.children)
7456 vnode.children.length = 0;
7457 if (cur === oldProps[key])
7458 continue;
7459 // #6601 work around Chrome version <= 55 bug where single textNode
7460 // replaced by innerHTML/textContent retains its parentNode property
7461 if (elm.childNodes.length === 1) {
7462 elm.removeChild(elm.childNodes[0]);
7463 }
7464 }
7465 if (key === 'value' && elm.tagName !== 'PROGRESS') {
7466 // store value as _value as well since
7467 // non-string values will be stringified
7468 elm._value = cur;
7469 // avoid resetting cursor position when value is the same
7470 const strCur = isUndef(cur) ? '' : String(cur);
7471 if (shouldUpdateValue(elm, strCur)) {
7472 elm.value = strCur;
7473 }
7474 }
7475 else if (key === 'innerHTML' &&
7476 isSVG(elm.tagName) &&
7477 isUndef(elm.innerHTML)) {
7478 // IE doesn't support innerHTML for SVG elements
7479 svgContainer = svgContainer || document.createElement('div');
7480 svgContainer.innerHTML = `<svg>${cur}</svg>`;
7481 const svg = svgContainer.firstChild;
7482 while (elm.firstChild) {
7483 elm.removeChild(elm.firstChild);
7484 }
7485 while (svg.firstChild) {
7486 elm.appendChild(svg.firstChild);
7487 }
7488 }
7489 else if (
7490 // skip the update if old and new VDOM state is the same.
7491 // `value` is handled separately because the DOM value may be temporarily
7492 // out of sync with VDOM state due to focus, composition and modifiers.
7493 // This #4521 by skipping the unnecessary `checked` update.
7494 cur !== oldProps[key]) {
7495 // some property updates can throw
7496 // e.g. `value` on <progress> w/ non-finite value
7497 try {
7498 elm[key] = cur;
7499 }
7500 catch (e) { }
7501 }
7502 }
7503}
7504function shouldUpdateValue(elm, checkVal) {
7505 return (
7506 //@ts-expect-error
7507 !elm.composing &&
7508 (elm.tagName === 'OPTION' ||
7509 isNotInFocusAndDirty(elm, checkVal) ||
7510 isDirtyWithModifiers(elm, checkVal)));
7511}
7512function isNotInFocusAndDirty(elm, checkVal) {
7513 // return true when textbox (.number and .trim) loses focus and its value is
7514 // not equal to the updated value
7515 let notInFocus = true;
7516 // #6157
7517 // work around IE bug when accessing document.activeElement in an iframe
7518 try {
7519 notInFocus = document.activeElement !== elm;
7520 }
7521 catch (e) { }
7522 return notInFocus && elm.value !== checkVal;
7523}
7524function isDirtyWithModifiers(elm, newVal) {
7525 const value = elm.value;
7526 const modifiers = elm._vModifiers; // injected by v-model runtime
7527 if (isDef(modifiers)) {
7528 if (modifiers.number) {
7529 return toNumber(value) !== toNumber(newVal);
7530 }
7531 if (modifiers.trim) {
7532 return value.trim() !== newVal.trim();
7533 }
7534 }
7535 return value !== newVal;
7536}
7537var domProps = {
7538 create: updateDOMProps,
7539 update: updateDOMProps
7540};
7541
7542const parseStyleText = cached(function (cssText) {
7543 const res = {};
7544 const listDelimiter = /;(?![^(]*\))/g;
7545 const propertyDelimiter = /:(.+)/;
7546 cssText.split(listDelimiter).forEach(function (item) {
7547 if (item) {
7548 const tmp = item.split(propertyDelimiter);
7549 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7550 }
7551 });
7552 return res;
7553});
7554// merge static and dynamic style data on the same vnode
7555function normalizeStyleData(data) {
7556 const style = normalizeStyleBinding(data.style);
7557 // static style is pre-processed into an object during compilation
7558 // and is always a fresh object, so it's safe to merge into it
7559 return data.staticStyle ? extend(data.staticStyle, style) : style;
7560}
7561// normalize possible array / string values into Object
7562function normalizeStyleBinding(bindingStyle) {
7563 if (Array.isArray(bindingStyle)) {
7564 return toObject(bindingStyle);
7565 }
7566 if (typeof bindingStyle === 'string') {
7567 return parseStyleText(bindingStyle);
7568 }
7569 return bindingStyle;
7570}
7571/**
7572 * parent component style should be after child's
7573 * so that parent component's style could override it
7574 */
7575function getStyle(vnode, checkChild) {
7576 const res = {};
7577 let styleData;
7578 if (checkChild) {
7579 let childNode = vnode;
7580 while (childNode.componentInstance) {
7581 childNode = childNode.componentInstance._vnode;
7582 if (childNode &&
7583 childNode.data &&
7584 (styleData = normalizeStyleData(childNode.data))) {
7585 extend(res, styleData);
7586 }
7587 }
7588 }
7589 if ((styleData = normalizeStyleData(vnode.data))) {
7590 extend(res, styleData);
7591 }
7592 let parentNode = vnode;
7593 // @ts-expect-error parentNode.parent not VNodeWithData
7594 while ((parentNode = parentNode.parent)) {
7595 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7596 extend(res, styleData);
7597 }
7598 }
7599 return res;
7600}
7601
7602const cssVarRE = /^--/;
7603const importantRE = /\s*!important$/;
7604const setProp = (el, name, val) => {
7605 /* istanbul ignore if */
7606 if (cssVarRE.test(name)) {
7607 el.style.setProperty(name, val);
7608 }
7609 else if (importantRE.test(val)) {
7610 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7611 }
7612 else {
7613 const normalizedName = normalize(name);
7614 if (Array.isArray(val)) {
7615 // Support values array created by autoprefixer, e.g.
7616 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7617 // Set them one by one, and the browser will only set those it can recognize
7618 for (let i = 0, len = val.length; i < len; i++) {
7619 el.style[normalizedName] = val[i];
7620 }
7621 }
7622 else {
7623 el.style[normalizedName] = val;
7624 }
7625 }
7626};
7627const vendorNames = ['Webkit', 'Moz', 'ms'];
7628let emptyStyle;
7629const normalize = cached(function (prop) {
7630 emptyStyle = emptyStyle || document.createElement('div').style;
7631 prop = camelize(prop);
7632 if (prop !== 'filter' && prop in emptyStyle) {
7633 return prop;
7634 }
7635 const capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7636 for (let i = 0; i < vendorNames.length; i++) {
7637 const name = vendorNames[i] + capName;
7638 if (name in emptyStyle) {
7639 return name;
7640 }
7641 }
7642});
7643function updateStyle(oldVnode, vnode) {
7644 const data = vnode.data;
7645 const oldData = oldVnode.data;
7646 if (isUndef(data.staticStyle) &&
7647 isUndef(data.style) &&
7648 isUndef(oldData.staticStyle) &&
7649 isUndef(oldData.style)) {
7650 return;
7651 }
7652 let cur, name;
7653 const el = vnode.elm;
7654 const oldStaticStyle = oldData.staticStyle;
7655 const oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7656 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7657 const oldStyle = oldStaticStyle || oldStyleBinding;
7658 const style = normalizeStyleBinding(vnode.data.style) || {};
7659 // store normalized style under a different key for next diff
7660 // make sure to clone it if it's reactive, since the user likely wants
7661 // to mutate it.
7662 vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
7663 const newStyle = getStyle(vnode, true);
7664 for (name in oldStyle) {
7665 if (isUndef(newStyle[name])) {
7666 setProp(el, name, '');
7667 }
7668 }
7669 for (name in newStyle) {
7670 cur = newStyle[name];
7671 if (cur !== oldStyle[name]) {
7672 // ie9 setting to null has no effect, must use empty string
7673 setProp(el, name, cur == null ? '' : cur);
7674 }
7675 }
7676}
7677var style = {
7678 create: updateStyle,
7679 update: updateStyle
7680};
7681
7682const whitespaceRE = /\s+/;
7683/**
7684 * Add class with compatibility for SVG since classList is not supported on
7685 * SVG elements in IE
7686 */
7687function addClass(el, cls) {
7688 /* istanbul ignore if */
7689 if (!cls || !(cls = cls.trim())) {
7690 return;
7691 }
7692 /* istanbul ignore else */
7693 if (el.classList) {
7694 if (cls.indexOf(' ') > -1) {
7695 cls.split(whitespaceRE).forEach(c => el.classList.add(c));
7696 }
7697 else {
7698 el.classList.add(cls);
7699 }
7700 }
7701 else {
7702 const cur = ` ${el.getAttribute('class') || ''} `;
7703 if (cur.indexOf(' ' + cls + ' ') < 0) {
7704 el.setAttribute('class', (cur + cls).trim());
7705 }
7706 }
7707}
7708/**
7709 * Remove class with compatibility for SVG since classList is not supported on
7710 * SVG elements in IE
7711 */
7712function removeClass(el, cls) {
7713 /* istanbul ignore if */
7714 if (!cls || !(cls = cls.trim())) {
7715 return;
7716 }
7717 /* istanbul ignore else */
7718 if (el.classList) {
7719 if (cls.indexOf(' ') > -1) {
7720 cls.split(whitespaceRE).forEach(c => el.classList.remove(c));
7721 }
7722 else {
7723 el.classList.remove(cls);
7724 }
7725 if (!el.classList.length) {
7726 el.removeAttribute('class');
7727 }
7728 }
7729 else {
7730 let cur = ` ${el.getAttribute('class') || ''} `;
7731 const tar = ' ' + cls + ' ';
7732 while (cur.indexOf(tar) >= 0) {
7733 cur = cur.replace(tar, ' ');
7734 }
7735 cur = cur.trim();
7736 if (cur) {
7737 el.setAttribute('class', cur);
7738 }
7739 else {
7740 el.removeAttribute('class');
7741 }
7742 }
7743}
7744
7745function resolveTransition(def) {
7746 if (!def) {
7747 return;
7748 }
7749 /* istanbul ignore else */
7750 if (typeof def === 'object') {
7751 const res = {};
7752 if (def.css !== false) {
7753 extend(res, autoCssTransition(def.name || 'v'));
7754 }
7755 extend(res, def);
7756 return res;
7757 }
7758 else if (typeof def === 'string') {
7759 return autoCssTransition(def);
7760 }
7761}
7762const autoCssTransition = cached(name => {
7763 return {
7764 enterClass: `${name}-enter`,
7765 enterToClass: `${name}-enter-to`,
7766 enterActiveClass: `${name}-enter-active`,
7767 leaveClass: `${name}-leave`,
7768 leaveToClass: `${name}-leave-to`,
7769 leaveActiveClass: `${name}-leave-active`
7770 };
7771});
7772const hasTransition = inBrowser && !isIE9;
7773const TRANSITION = 'transition';
7774const ANIMATION = 'animation';
7775// Transition property/event sniffing
7776let transitionProp = 'transition';
7777let transitionEndEvent = 'transitionend';
7778let animationProp = 'animation';
7779let animationEndEvent = 'animationend';
7780if (hasTransition) {
7781 /* istanbul ignore if */
7782 if (window.ontransitionend === undefined &&
7783 window.onwebkittransitionend !== undefined) {
7784 transitionProp = 'WebkitTransition';
7785 transitionEndEvent = 'webkitTransitionEnd';
7786 }
7787 if (window.onanimationend === undefined &&
7788 window.onwebkitanimationend !== undefined) {
7789 animationProp = 'WebkitAnimation';
7790 animationEndEvent = 'webkitAnimationEnd';
7791 }
7792}
7793// binding to window is necessary to make hot reload work in IE in strict mode
7794const raf = inBrowser
7795 ? window.requestAnimationFrame
7796 ? window.requestAnimationFrame.bind(window)
7797 : setTimeout
7798 : /* istanbul ignore next */ /* istanbul ignore next */ fn => fn();
7799function nextFrame(fn) {
7800 raf(() => {
7801 // @ts-expect-error
7802 raf(fn);
7803 });
7804}
7805function addTransitionClass(el, cls) {
7806 const transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7807 if (transitionClasses.indexOf(cls) < 0) {
7808 transitionClasses.push(cls);
7809 addClass(el, cls);
7810 }
7811}
7812function removeTransitionClass(el, cls) {
7813 if (el._transitionClasses) {
7814 remove$2(el._transitionClasses, cls);
7815 }
7816 removeClass(el, cls);
7817}
7818function whenTransitionEnds(el, expectedType, cb) {
7819 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
7820 if (!type)
7821 return cb();
7822 const event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7823 let ended = 0;
7824 const end = () => {
7825 el.removeEventListener(event, onEnd);
7826 cb();
7827 };
7828 const onEnd = e => {
7829 if (e.target === el) {
7830 if (++ended >= propCount) {
7831 end();
7832 }
7833 }
7834 };
7835 setTimeout(() => {
7836 if (ended < propCount) {
7837 end();
7838 }
7839 }, timeout + 1);
7840 el.addEventListener(event, onEnd);
7841}
7842const transformRE = /\b(transform|all)(,|$)/;
7843function getTransitionInfo(el, expectedType) {
7844 const styles = window.getComputedStyle(el);
7845 // JSDOM may return undefined for transition properties
7846 const transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7847 const transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7848 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7849 const animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7850 const animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7851 const animationTimeout = getTimeout(animationDelays, animationDurations);
7852 let type;
7853 let timeout = 0;
7854 let propCount = 0;
7855 /* istanbul ignore if */
7856 if (expectedType === TRANSITION) {
7857 if (transitionTimeout > 0) {
7858 type = TRANSITION;
7859 timeout = transitionTimeout;
7860 propCount = transitionDurations.length;
7861 }
7862 }
7863 else if (expectedType === ANIMATION) {
7864 if (animationTimeout > 0) {
7865 type = ANIMATION;
7866 timeout = animationTimeout;
7867 propCount = animationDurations.length;
7868 }
7869 }
7870 else {
7871 timeout = Math.max(transitionTimeout, animationTimeout);
7872 type =
7873 timeout > 0
7874 ? transitionTimeout > animationTimeout
7875 ? TRANSITION
7876 : ANIMATION
7877 : null;
7878 propCount = type
7879 ? type === TRANSITION
7880 ? transitionDurations.length
7881 : animationDurations.length
7882 : 0;
7883 }
7884 const hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
7885 return {
7886 type,
7887 timeout,
7888 propCount,
7889 hasTransform
7890 };
7891}
7892function getTimeout(delays, durations) {
7893 /* istanbul ignore next */
7894 while (delays.length < durations.length) {
7895 delays = delays.concat(delays);
7896 }
7897 return Math.max.apply(null, durations.map((d, i) => {
7898 return toMs(d) + toMs(delays[i]);
7899 }));
7900}
7901// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7902// in a locale-dependent way, using a comma instead of a dot.
7903// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7904// as a floor function) causing unexpected behaviors
7905function toMs(s) {
7906 return Number(s.slice(0, -1).replace(',', '.')) * 1000;
7907}
7908
7909function enter(vnode, toggleDisplay) {
7910 const el = vnode.elm;
7911 // call leave callback now
7912 if (isDef(el._leaveCb)) {
7913 el._leaveCb.cancelled = true;
7914 el._leaveCb();
7915 }
7916 const data = resolveTransition(vnode.data.transition);
7917 if (isUndef(data)) {
7918 return;
7919 }
7920 /* istanbul ignore if */
7921 if (isDef(el._enterCb) || el.nodeType !== 1) {
7922 return;
7923 }
7924 const { css, type, enterClass, enterToClass, enterActiveClass, appearClass, appearToClass, appearActiveClass, beforeEnter, enter, afterEnter, enterCancelled, beforeAppear, appear, afterAppear, appearCancelled, duration } = data;
7925 // activeInstance will always be the <transition> component managing this
7926 // transition. One edge case to check is when the <transition> is placed
7927 // as the root node of a child component. In that case we need to check
7928 // <transition>'s parent for appear check.
7929 let context = activeInstance;
7930 let transitionNode = activeInstance.$vnode;
7931 while (transitionNode && transitionNode.parent) {
7932 context = transitionNode.context;
7933 transitionNode = transitionNode.parent;
7934 }
7935 const isAppear = !context._isMounted || !vnode.isRootInsert;
7936 if (isAppear && !appear && appear !== '') {
7937 return;
7938 }
7939 const startClass = isAppear && appearClass ? appearClass : enterClass;
7940 const activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
7941 const toClass = isAppear && appearToClass ? appearToClass : enterToClass;
7942 const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
7943 const enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
7944 const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
7945 const enterCancelledHook = isAppear
7946 ? appearCancelled || enterCancelled
7947 : enterCancelled;
7948 const explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
7949 if (explicitEnterDuration != null) {
7950 checkDuration(explicitEnterDuration, 'enter', vnode);
7951 }
7952 const expectsCSS = css !== false && !isIE9;
7953 const userWantsControl = getHookArgumentsLength(enterHook);
7954 const cb = (el._enterCb = once(() => {
7955 if (expectsCSS) {
7956 removeTransitionClass(el, toClass);
7957 removeTransitionClass(el, activeClass);
7958 }
7959 // @ts-expect-error
7960 if (cb.cancelled) {
7961 if (expectsCSS) {
7962 removeTransitionClass(el, startClass);
7963 }
7964 enterCancelledHook && enterCancelledHook(el);
7965 }
7966 else {
7967 afterEnterHook && afterEnterHook(el);
7968 }
7969 el._enterCb = null;
7970 }));
7971 if (!vnode.data.show) {
7972 // remove pending leave element on enter by injecting an insert hook
7973 mergeVNodeHook(vnode, 'insert', () => {
7974 const parent = el.parentNode;
7975 const pendingNode = parent && parent._pending && parent._pending[vnode.key];
7976 if (pendingNode &&
7977 pendingNode.tag === vnode.tag &&
7978 pendingNode.elm._leaveCb) {
7979 pendingNode.elm._leaveCb();
7980 }
7981 enterHook && enterHook(el, cb);
7982 });
7983 }
7984 // start enter transition
7985 beforeEnterHook && beforeEnterHook(el);
7986 if (expectsCSS) {
7987 addTransitionClass(el, startClass);
7988 addTransitionClass(el, activeClass);
7989 nextFrame(() => {
7990 removeTransitionClass(el, startClass);
7991 // @ts-expect-error
7992 if (!cb.cancelled) {
7993 addTransitionClass(el, toClass);
7994 if (!userWantsControl) {
7995 if (isValidDuration(explicitEnterDuration)) {
7996 setTimeout(cb, explicitEnterDuration);
7997 }
7998 else {
7999 whenTransitionEnds(el, type, cb);
8000 }
8001 }
8002 }
8003 });
8004 }
8005 if (vnode.data.show) {
8006 toggleDisplay && toggleDisplay();
8007 enterHook && enterHook(el, cb);
8008 }
8009 if (!expectsCSS && !userWantsControl) {
8010 cb();
8011 }
8012}
8013function leave(vnode, rm) {
8014 const el = vnode.elm;
8015 // call enter callback now
8016 if (isDef(el._enterCb)) {
8017 el._enterCb.cancelled = true;
8018 el._enterCb();
8019 }
8020 const data = resolveTransition(vnode.data.transition);
8021 if (isUndef(data) || el.nodeType !== 1) {
8022 return rm();
8023 }
8024 /* istanbul ignore if */
8025 if (isDef(el._leaveCb)) {
8026 return;
8027 }
8028 const { css, type, leaveClass, leaveToClass, leaveActiveClass, beforeLeave, leave, afterLeave, leaveCancelled, delayLeave, duration } = data;
8029 const expectsCSS = css !== false && !isIE9;
8030 const userWantsControl = getHookArgumentsLength(leave);
8031 const explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
8032 if (isDef(explicitLeaveDuration)) {
8033 checkDuration(explicitLeaveDuration, 'leave', vnode);
8034 }
8035 const cb = (el._leaveCb = once(() => {
8036 if (el.parentNode && el.parentNode._pending) {
8037 el.parentNode._pending[vnode.key] = null;
8038 }
8039 if (expectsCSS) {
8040 removeTransitionClass(el, leaveToClass);
8041 removeTransitionClass(el, leaveActiveClass);
8042 }
8043 // @ts-expect-error
8044 if (cb.cancelled) {
8045 if (expectsCSS) {
8046 removeTransitionClass(el, leaveClass);
8047 }
8048 leaveCancelled && leaveCancelled(el);
8049 }
8050 else {
8051 rm();
8052 afterLeave && afterLeave(el);
8053 }
8054 el._leaveCb = null;
8055 }));
8056 if (delayLeave) {
8057 delayLeave(performLeave);
8058 }
8059 else {
8060 performLeave();
8061 }
8062 function performLeave() {
8063 // the delayed leave may have already been cancelled
8064 // @ts-expect-error
8065 if (cb.cancelled) {
8066 return;
8067 }
8068 // record leaving element
8069 if (!vnode.data.show && el.parentNode) {
8070 (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
8071 vnode;
8072 }
8073 beforeLeave && beforeLeave(el);
8074 if (expectsCSS) {
8075 addTransitionClass(el, leaveClass);
8076 addTransitionClass(el, leaveActiveClass);
8077 nextFrame(() => {
8078 removeTransitionClass(el, leaveClass);
8079 // @ts-expect-error
8080 if (!cb.cancelled) {
8081 addTransitionClass(el, leaveToClass);
8082 if (!userWantsControl) {
8083 if (isValidDuration(explicitLeaveDuration)) {
8084 setTimeout(cb, explicitLeaveDuration);
8085 }
8086 else {
8087 whenTransitionEnds(el, type, cb);
8088 }
8089 }
8090 }
8091 });
8092 }
8093 leave && leave(el, cb);
8094 if (!expectsCSS && !userWantsControl) {
8095 cb();
8096 }
8097 }
8098}
8099// only used in dev mode
8100function checkDuration(val, name, vnode) {
8101 if (typeof val !== 'number') {
8102 warn(`<transition> explicit ${name} duration is not a valid number - ` +
8103 `got ${JSON.stringify(val)}.`, vnode.context);
8104 }
8105 else if (isNaN(val)) {
8106 warn(`<transition> explicit ${name} duration is NaN - ` +
8107 'the duration expression might be incorrect.', vnode.context);
8108 }
8109}
8110function isValidDuration(val) {
8111 return typeof val === 'number' && !isNaN(val);
8112}
8113/**
8114 * Normalize a transition hook's argument length. The hook may be:
8115 * - a merged hook (invoker) with the original in .fns
8116 * - a wrapped component method (check ._length)
8117 * - a plain function (.length)
8118 */
8119function getHookArgumentsLength(fn) {
8120 if (isUndef(fn)) {
8121 return false;
8122 }
8123 // @ts-expect-error
8124 const invokerFns = fn.fns;
8125 if (isDef(invokerFns)) {
8126 // invoker
8127 return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
8128 }
8129 else {
8130 // @ts-expect-error
8131 return (fn._length || fn.length) > 1;
8132 }
8133}
8134function _enter(_, vnode) {
8135 if (vnode.data.show !== true) {
8136 enter(vnode);
8137 }
8138}
8139var transition = inBrowser
8140 ? {
8141 create: _enter,
8142 activate: _enter,
8143 remove(vnode, rm) {
8144 /* istanbul ignore else */
8145 if (vnode.data.show !== true) {
8146 // @ts-expect-error
8147 leave(vnode, rm);
8148 }
8149 else {
8150 rm();
8151 }
8152 }
8153 }
8154 : {};
8155
8156var platformModules = [attrs, klass, events, domProps, style, transition];
8157
8158// the directive module should be applied last, after all
8159// built-in modules have been applied.
8160const modules = platformModules.concat(baseModules);
8161const patch = createPatchFunction({ nodeOps, modules });
8162
8163/**
8164 * Not type checking this file because flow doesn't like attaching
8165 * properties to Elements.
8166 */
8167/* istanbul ignore if */
8168if (isIE9) {
8169 // http://www.matts411.com/post/internet-explorer-9-oninput/
8170 document.addEventListener('selectionchange', () => {
8171 const el = document.activeElement;
8172 // @ts-expect-error
8173 if (el && el.vmodel) {
8174 trigger(el, 'input');
8175 }
8176 });
8177}
8178const directive = {
8179 inserted(el, binding, vnode, oldVnode) {
8180 if (vnode.tag === 'select') {
8181 // #6903
8182 if (oldVnode.elm && !oldVnode.elm._vOptions) {
8183 mergeVNodeHook(vnode, 'postpatch', () => {
8184 directive.componentUpdated(el, binding, vnode);
8185 });
8186 }
8187 else {
8188 setSelected(el, binding, vnode.context);
8189 }
8190 el._vOptions = [].map.call(el.options, getValue);
8191 }
8192 else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8193 el._vModifiers = binding.modifiers;
8194 if (!binding.modifiers.lazy) {
8195 el.addEventListener('compositionstart', onCompositionStart);
8196 el.addEventListener('compositionend', onCompositionEnd);
8197 // Safari < 10.2 & UIWebView doesn't fire compositionend when
8198 // switching focus before confirming composition choice
8199 // this also fixes the issue where some browsers e.g. iOS Chrome
8200 // fires "change" instead of "input" on autocomplete.
8201 el.addEventListener('change', onCompositionEnd);
8202 /* istanbul ignore if */
8203 if (isIE9) {
8204 el.vmodel = true;
8205 }
8206 }
8207 }
8208 },
8209 componentUpdated(el, binding, vnode) {
8210 if (vnode.tag === 'select') {
8211 setSelected(el, binding, vnode.context);
8212 // in case the options rendered by v-for have changed,
8213 // it's possible that the value is out-of-sync with the rendered options.
8214 // detect such cases and filter out values that no longer has a matching
8215 // option in the DOM.
8216 const prevOptions = el._vOptions;
8217 const curOptions = (el._vOptions = [].map.call(el.options, getValue));
8218 if (curOptions.some((o, i) => !looseEqual(o, prevOptions[i]))) {
8219 // trigger change event if
8220 // no matching option found for at least one value
8221 const needReset = el.multiple
8222 ? binding.value.some(v => hasNoMatchingOption(v, curOptions))
8223 : binding.value !== binding.oldValue &&
8224 hasNoMatchingOption(binding.value, curOptions);
8225 if (needReset) {
8226 trigger(el, 'change');
8227 }
8228 }
8229 }
8230 }
8231};
8232function setSelected(el, binding, vm) {
8233 actuallySetSelected(el, binding, vm);
8234 /* istanbul ignore if */
8235 if (isIE || isEdge) {
8236 setTimeout(() => {
8237 actuallySetSelected(el, binding, vm);
8238 }, 0);
8239 }
8240}
8241function actuallySetSelected(el, binding, vm) {
8242 const value = binding.value;
8243 const isMultiple = el.multiple;
8244 if (isMultiple && !Array.isArray(value)) {
8245 warn(`<select multiple v-model="${binding.expression}"> ` +
8246 `expects an Array value for its binding, but got ${Object.prototype.toString
8247 .call(value)
8248 .slice(8, -1)}`, vm);
8249 return;
8250 }
8251 let selected, option;
8252 for (let i = 0, l = el.options.length; i < l; i++) {
8253 option = el.options[i];
8254 if (isMultiple) {
8255 selected = looseIndexOf(value, getValue(option)) > -1;
8256 if (option.selected !== selected) {
8257 option.selected = selected;
8258 }
8259 }
8260 else {
8261 if (looseEqual(getValue(option), value)) {
8262 if (el.selectedIndex !== i) {
8263 el.selectedIndex = i;
8264 }
8265 return;
8266 }
8267 }
8268 }
8269 if (!isMultiple) {
8270 el.selectedIndex = -1;
8271 }
8272}
8273function hasNoMatchingOption(value, options) {
8274 return options.every(o => !looseEqual(o, value));
8275}
8276function getValue(option) {
8277 return '_value' in option ? option._value : option.value;
8278}
8279function onCompositionStart(e) {
8280 e.target.composing = true;
8281}
8282function onCompositionEnd(e) {
8283 // prevent triggering an input event for no reason
8284 if (!e.target.composing)
8285 return;
8286 e.target.composing = false;
8287 trigger(e.target, 'input');
8288}
8289function trigger(el, type) {
8290 const e = document.createEvent('HTMLEvents');
8291 e.initEvent(type, true, true);
8292 el.dispatchEvent(e);
8293}
8294
8295// recursively search for possible transition defined inside the component root
8296function locateNode(vnode) {
8297 // @ts-expect-error
8298 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
8299 ? locateNode(vnode.componentInstance._vnode)
8300 : vnode;
8301}
8302var show = {
8303 bind(el, { value }, vnode) {
8304 vnode = locateNode(vnode);
8305 const transition = vnode.data && vnode.data.transition;
8306 const originalDisplay = (el.__vOriginalDisplay =
8307 el.style.display === 'none' ? '' : el.style.display);
8308 if (value && transition) {
8309 vnode.data.show = true;
8310 enter(vnode, () => {
8311 el.style.display = originalDisplay;
8312 });
8313 }
8314 else {
8315 el.style.display = value ? originalDisplay : 'none';
8316 }
8317 },
8318 update(el, { value, oldValue }, vnode) {
8319 /* istanbul ignore if */
8320 if (!value === !oldValue)
8321 return;
8322 vnode = locateNode(vnode);
8323 const transition = vnode.data && vnode.data.transition;
8324 if (transition) {
8325 vnode.data.show = true;
8326 if (value) {
8327 enter(vnode, () => {
8328 el.style.display = el.__vOriginalDisplay;
8329 });
8330 }
8331 else {
8332 leave(vnode, () => {
8333 el.style.display = 'none';
8334 });
8335 }
8336 }
8337 else {
8338 el.style.display = value ? el.__vOriginalDisplay : 'none';
8339 }
8340 },
8341 unbind(el, binding, vnode, oldVnode, isDestroy) {
8342 if (!isDestroy) {
8343 el.style.display = el.__vOriginalDisplay;
8344 }
8345 }
8346};
8347
8348var platformDirectives = {
8349 model: directive,
8350 show
8351};
8352
8353// Provides transition support for a single element/component.
8354const transitionProps = {
8355 name: String,
8356 appear: Boolean,
8357 css: Boolean,
8358 mode: String,
8359 type: String,
8360 enterClass: String,
8361 leaveClass: String,
8362 enterToClass: String,
8363 leaveToClass: String,
8364 enterActiveClass: String,
8365 leaveActiveClass: String,
8366 appearClass: String,
8367 appearActiveClass: String,
8368 appearToClass: String,
8369 duration: [Number, String, Object]
8370};
8371// in case the child is also an abstract component, e.g. <keep-alive>
8372// we want to recursively retrieve the real component to be rendered
8373function getRealChild(vnode) {
8374 const compOptions = vnode && vnode.componentOptions;
8375 if (compOptions && compOptions.Ctor.options.abstract) {
8376 return getRealChild(getFirstComponentChild(compOptions.children));
8377 }
8378 else {
8379 return vnode;
8380 }
8381}
8382function extractTransitionData(comp) {
8383 const data = {};
8384 const options = comp.$options;
8385 // props
8386 for (const key in options.propsData) {
8387 data[key] = comp[key];
8388 }
8389 // events.
8390 // extract listeners and pass them directly to the transition methods
8391 const listeners = options._parentListeners;
8392 for (const key in listeners) {
8393 data[camelize(key)] = listeners[key];
8394 }
8395 return data;
8396}
8397function placeholder(h, rawChild) {
8398 // @ts-expect-error
8399 if (/\d-keep-alive$/.test(rawChild.tag)) {
8400 return h('keep-alive', {
8401 props: rawChild.componentOptions.propsData
8402 });
8403 }
8404}
8405function hasParentTransition(vnode) {
8406 while ((vnode = vnode.parent)) {
8407 if (vnode.data.transition) {
8408 return true;
8409 }
8410 }
8411}
8412function isSameChild(child, oldChild) {
8413 return oldChild.key === child.key && oldChild.tag === child.tag;
8414}
8415const isNotTextNode = (c) => c.tag || isAsyncPlaceholder(c);
8416const isVShowDirective = d => d.name === 'show';
8417var Transition = {
8418 name: 'transition',
8419 props: transitionProps,
8420 abstract: true,
8421 render(h) {
8422 let children = this.$slots.default;
8423 if (!children) {
8424 return;
8425 }
8426 // filter out text nodes (possible whitespaces)
8427 children = children.filter(isNotTextNode);
8428 /* istanbul ignore if */
8429 if (!children.length) {
8430 return;
8431 }
8432 // warn multiple elements
8433 if (children.length > 1) {
8434 warn('<transition> can only be used on a single element. Use ' +
8435 '<transition-group> for lists.', this.$parent);
8436 }
8437 const mode = this.mode;
8438 // warn invalid mode
8439 if (mode && mode !== 'in-out' && mode !== 'out-in') {
8440 warn('invalid <transition> mode: ' + mode, this.$parent);
8441 }
8442 const rawChild = children[0];
8443 // if this is a component root node and the component's
8444 // parent container node also has transition, skip.
8445 if (hasParentTransition(this.$vnode)) {
8446 return rawChild;
8447 }
8448 // apply transition data to child
8449 // use getRealChild() to ignore abstract components e.g. keep-alive
8450 const child = getRealChild(rawChild);
8451 /* istanbul ignore if */
8452 if (!child) {
8453 return rawChild;
8454 }
8455 if (this._leaving) {
8456 return placeholder(h, rawChild);
8457 }
8458 // ensure a key that is unique to the vnode type and to this transition
8459 // component instance. This key will be used to remove pending leaving nodes
8460 // during entering.
8461 const id = `__transition-${this._uid}-`;
8462 child.key =
8463 child.key == null
8464 ? child.isComment
8465 ? id + 'comment'
8466 : id + child.tag
8467 : isPrimitive(child.key)
8468 ? String(child.key).indexOf(id) === 0
8469 ? child.key
8470 : id + child.key
8471 : child.key;
8472 const data = ((child.data || (child.data = {})).transition =
8473 extractTransitionData(this));
8474 const oldRawChild = this._vnode;
8475 const oldChild = getRealChild(oldRawChild);
8476 // mark v-show
8477 // so that the transition module can hand over the control to the directive
8478 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8479 child.data.show = true;
8480 }
8481 if (oldChild &&
8482 oldChild.data &&
8483 !isSameChild(child, oldChild) &&
8484 !isAsyncPlaceholder(oldChild) &&
8485 // #6687 component root is a comment node
8486 !(oldChild.componentInstance &&
8487 oldChild.componentInstance._vnode.isComment)) {
8488 // replace old child transition data with fresh one
8489 // important for dynamic transitions!
8490 const oldData = (oldChild.data.transition = extend({}, data));
8491 // handle transition mode
8492 if (mode === 'out-in') {
8493 // return placeholder node and queue update when leave finishes
8494 this._leaving = true;
8495 mergeVNodeHook(oldData, 'afterLeave', () => {
8496 this._leaving = false;
8497 this.$forceUpdate();
8498 });
8499 return placeholder(h, rawChild);
8500 }
8501 else if (mode === 'in-out') {
8502 if (isAsyncPlaceholder(child)) {
8503 return oldRawChild;
8504 }
8505 let delayedLeave;
8506 const performLeave = () => {
8507 delayedLeave();
8508 };
8509 mergeVNodeHook(data, 'afterEnter', performLeave);
8510 mergeVNodeHook(data, 'enterCancelled', performLeave);
8511 mergeVNodeHook(oldData, 'delayLeave', leave => {
8512 delayedLeave = leave;
8513 });
8514 }
8515 }
8516 return rawChild;
8517 }
8518};
8519
8520// Provides transition support for list items.
8521const props = extend({
8522 tag: String,
8523 moveClass: String
8524}, transitionProps);
8525delete props.mode;
8526var TransitionGroup = {
8527 props,
8528 beforeMount() {
8529 const update = this._update;
8530 this._update = (vnode, hydrating) => {
8531 const restoreActiveInstance = setActiveInstance(this);
8532 // force removing pass
8533 this.__patch__(this._vnode, this.kept, false, // hydrating
8534 true // removeOnly (!important, avoids unnecessary moves)
8535 );
8536 this._vnode = this.kept;
8537 restoreActiveInstance();
8538 update.call(this, vnode, hydrating);
8539 };
8540 },
8541 render(h) {
8542 const tag = this.tag || this.$vnode.data.tag || 'span';
8543 const map = Object.create(null);
8544 const prevChildren = (this.prevChildren = this.children);
8545 const rawChildren = this.$slots.default || [];
8546 const children = (this.children = []);
8547 const transitionData = extractTransitionData(this);
8548 for (let i = 0; i < rawChildren.length; i++) {
8549 const c = rawChildren[i];
8550 if (c.tag) {
8551 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8552 children.push(c);
8553 map[c.key] = c;
8554 (c.data || (c.data = {})).transition = transitionData;
8555 }
8556 else {
8557 const opts = c.componentOptions;
8558 const name = opts
8559 ? getComponentName(opts.Ctor.options) || opts.tag || ''
8560 : c.tag;
8561 warn(`<transition-group> children must be keyed: <${name}>`);
8562 }
8563 }
8564 }
8565 if (prevChildren) {
8566 const kept = [];
8567 const removed = [];
8568 for (let i = 0; i < prevChildren.length; i++) {
8569 const c = prevChildren[i];
8570 c.data.transition = transitionData;
8571 // @ts-expect-error .getBoundingClientRect is not typed in Node
8572 c.data.pos = c.elm.getBoundingClientRect();
8573 if (map[c.key]) {
8574 kept.push(c);
8575 }
8576 else {
8577 removed.push(c);
8578 }
8579 }
8580 this.kept = h(tag, null, kept);
8581 this.removed = removed;
8582 }
8583 return h(tag, null, children);
8584 },
8585 updated() {
8586 const children = this.prevChildren;
8587 const moveClass = this.moveClass || (this.name || 'v') + '-move';
8588 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8589 return;
8590 }
8591 // we divide the work into three loops to avoid mixing DOM reads and writes
8592 // in each iteration - which helps prevent layout thrashing.
8593 children.forEach(callPendingCbs);
8594 children.forEach(recordPosition);
8595 children.forEach(applyTranslation);
8596 // force reflow to put everything in position
8597 // assign to this to avoid being removed in tree-shaking
8598 // $flow-disable-line
8599 this._reflow = document.body.offsetHeight;
8600 children.forEach((c) => {
8601 if (c.data.moved) {
8602 const el = c.elm;
8603 const s = el.style;
8604 addTransitionClass(el, moveClass);
8605 s.transform = s.WebkitTransform = s.transitionDuration = '';
8606 el.addEventListener(transitionEndEvent, (el._moveCb = function cb(e) {
8607 if (e && e.target !== el) {
8608 return;
8609 }
8610 if (!e || /transform$/.test(e.propertyName)) {
8611 el.removeEventListener(transitionEndEvent, cb);
8612 el._moveCb = null;
8613 removeTransitionClass(el, moveClass);
8614 }
8615 }));
8616 }
8617 });
8618 },
8619 methods: {
8620 hasMove(el, moveClass) {
8621 /* istanbul ignore if */
8622 if (!hasTransition) {
8623 return false;
8624 }
8625 /* istanbul ignore if */
8626 if (this._hasMove) {
8627 return this._hasMove;
8628 }
8629 // Detect whether an element with the move class applied has
8630 // CSS transitions. Since the element may be inside an entering
8631 // transition at this very moment, we make a clone of it and remove
8632 // all other transition classes applied to ensure only the move class
8633 // is applied.
8634 const clone = el.cloneNode();
8635 if (el._transitionClasses) {
8636 el._transitionClasses.forEach((cls) => {
8637 removeClass(clone, cls);
8638 });
8639 }
8640 addClass(clone, moveClass);
8641 clone.style.display = 'none';
8642 this.$el.appendChild(clone);
8643 const info = getTransitionInfo(clone);
8644 this.$el.removeChild(clone);
8645 return (this._hasMove = info.hasTransform);
8646 }
8647 }
8648};
8649function callPendingCbs(c) {
8650 /* istanbul ignore if */
8651 if (c.elm._moveCb) {
8652 c.elm._moveCb();
8653 }
8654 /* istanbul ignore if */
8655 if (c.elm._enterCb) {
8656 c.elm._enterCb();
8657 }
8658}
8659function recordPosition(c) {
8660 c.data.newPos = c.elm.getBoundingClientRect();
8661}
8662function applyTranslation(c) {
8663 const oldPos = c.data.pos;
8664 const newPos = c.data.newPos;
8665 const dx = oldPos.left - newPos.left;
8666 const dy = oldPos.top - newPos.top;
8667 if (dx || dy) {
8668 c.data.moved = true;
8669 const s = c.elm.style;
8670 s.transform = s.WebkitTransform = `translate(${dx}px,${dy}px)`;
8671 s.transitionDuration = '0s';
8672 }
8673}
8674
8675var platformComponents = {
8676 Transition,
8677 TransitionGroup
8678};
8679
8680// install platform specific utils
8681Vue.config.mustUseProp = mustUseProp;
8682Vue.config.isReservedTag = isReservedTag;
8683Vue.config.isReservedAttr = isReservedAttr;
8684Vue.config.getTagNamespace = getTagNamespace;
8685Vue.config.isUnknownElement = isUnknownElement;
8686// install platform runtime directives & components
8687extend(Vue.options.directives, platformDirectives);
8688extend(Vue.options.components, platformComponents);
8689// install platform patch function
8690Vue.prototype.__patch__ = inBrowser ? patch : noop;
8691// public mount method
8692Vue.prototype.$mount = function (el, hydrating) {
8693 el = el && inBrowser ? query(el) : undefined;
8694 return mountComponent(this, el, hydrating);
8695};
8696// devtools global hook
8697/* istanbul ignore next */
8698if (inBrowser) {
8699 setTimeout(() => {
8700 if (config.devtools) {
8701 if (devtools) {
8702 devtools.emit('init', Vue);
8703 }
8704 else {
8705 // @ts-expect-error
8706 console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
8707 'https://github.com/vuejs/vue-devtools');
8708 }
8709 }
8710 if (config.productionTip !== false &&
8711 typeof console !== 'undefined') {
8712 // @ts-expect-error
8713 console[console.info ? 'info' : 'log'](`You are running Vue in development mode.\n` +
8714 `Make sure to turn on production mode when deploying for production.\n` +
8715 `See more tips at https://vuejs.org/guide/deployment.html`);
8716 }
8717 }, 0);
8718}
8719
8720extend(Vue, vca);
8721
8722module.exports = Vue;