UNPKG

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