UNPKG

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